MessageEvent Class
https://html.spec.whatwg.org/multipage/comms.html#messageevent
public sealed class MessageEvent : Event- Inheritance
EventMessageEvent
Constructors
| Name | Description |
|---|---|
| MessageEvent(string, MessageEventInit?) | Creates a message event with the given type and initialization dictionary. |
MessageEvent(string, MessageEventInit?)
HtmlEvents.csCreates a message event with the given type and initialization dictionary.
public MessageEvent(string type, MessageEventInit? eventInitDict = null)Properties
| Name | Description |
|---|---|
| Data | Gets the data of the message. |
| LastEventId | Gets the last event ID of the event source that sent the message. |
| Origin | Gets the origin of the message sender. |
| Ports | Gets the message ports sent with the message (https://html.spec.whatwg.org/multipage/comms.html#dom-messageevent-ports). |
| Source | Gets the object that sent the message, such as a window or a message port. |
Data
HtmlEvents.csLastEventId
HtmlEvents.csGets the last event ID of the event source that sent the message.
public string LastEventId { get; }Property value
See also
Origin
HtmlEvents.csPorts
HtmlEvents.csGets the message ports sent with the message (https://html.spec.whatwg.org/multipage/comms.html#dom-messageevent-ports).
public IReadOnlyList<MessagePort> Ports { get; }Source
HtmlEvents.csGets the object that sent the message, such as a window or a message port.
public EventTarget? Source { get; }Property value
See also
Methods
| Name | Description |
|---|---|
| InitMessageEvent(string, bool, bool, object?, string, string, EventTarget?, IReadOnlyList<MessagePort>?) | https://html.spec.whatwg.org/multipage/comms.html#dom-messageevent-initmessageevent |
InitMessageEvent(string, bool, bool, object?, string, string, EventTarget?, IReadOnlyList<MessagePort>?)
HtmlEvents.cshttps://html.spec.whatwg.org/multipage/comms.html#dom-messageevent-initmessageevent
public void InitMessageEvent(string type, bool bubbles = false, bool cancelable = false, object? data = null, string origin = "", string lastEventId = "", EventTarget? source = null, IReadOnlyList<MessagePort>? ports = null)Parameters
typestringbubblesboolcancelablebooldataobject?originstringlastEventIdstringsourceEventTarget?portsIReadOnlyList<MessagePort>?