Table of Contents

Class MessageEvent

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The MessageEvent interface represents a message received by a target object.

[Value("MessageEvent")]
public class MessageEvent : Event
Inheritance
MessageEvent
Inherited Members

Remarks

This is used to represent messages in:

The action triggered by this event is defined in a function set as the event handler for the relevant message event.

-ExtendableMessageEvent — similar to this interface but used in interfaces that needs to give more flexibility to authors.

See also on MDN

Constructors

MessageEvent()

public MessageEvent()

MessageEvent(string, MessageEventInit)

The MessageEvent() constructor creates a new MessageEvent object.

public MessageEvent(string type, MessageEventInit eventInitDict = null)

Parameters

type string
eventInitDict MessageEventInit

Remarks

-ExtendableMessageEvent — similar to this interface but used in interfaces that needs to give more flexibility to authors.

See also on MDN

Properties

Data

The data read-only property of the
MessageEvent interface represents the data sent by the message emitter.

[Value("data")]
public dynamic Data { get; }

Property Value

dynamic

The data sent by the message emitter; this can be any data type, depending on what originated this event.

Remarks

-ExtendableMessageEvent — similar to this interface but used in
interfaces that needs to give more flexibility to authors.

See also on MDN

LastEventId

The lastEventId read-only property of the
MessageEvent interface is a string representing a
unique ID for the event.

[Value("lastEventId")]
public string LastEventId { get; }

Property Value

string

A string representing the ID.

Remarks

-ExtendableMessageEvent — similar to this interface but used in
interfaces that needs to give more flexibility to authors.

See also on MDN

Origin

The origin read-only property of the
MessageEvent interface is a string representing the
origin of the message emitter.

[Value("origin")]
public string Origin { get; }

Property Value

string

A string representing the origin.

Remarks

-ExtendableMessageEvent — similar to this interface but used in
interfaces that needs to give more flexibility to authors.

See also on MDN

Ports

The ports read-only property of the
MessageEvent interface is an array of MessagePort objects
containing all MessagePort objects sent with the message, in order.

[Value("ports")]
public MessagePort[] Ports { get; }

Property Value

MessagePort[]

An array of MessagePort objects.

Remarks

-ExtendableMessageEvent — similar to this interface but used in
interfaces that needs to give more flexibility to authors.

See also on MDN

Source

The source read-only property of the
MessageEvent interface is a MessageEventSource (which can be
a {{glossary("WindowProxy")}}, MessagePort, or
ServiceWorker object) representing the message emitter.

[Value("source")]
public Union94? Source { get; }

Property Value

Union94?

a MessageEventSource (which can be a WindowProxy,
MessagePort, or ServiceWorker object) representing the
message emitter.

Remarks

-ExtendableMessageEvent — similar to this interface but used in
interfaces that needs to give more flexibility to authors.

See also on MDN

Methods

InitMessageEvent(string, bool, bool, dynamic, string, string, Union94?, List<MessagePort>)

[Value("initMessageEvent")]
public GlobalObject.Undefined InitMessageEvent(string type, bool bubbles = false, bool cancelable = false, dynamic data = null, string origin = null, string lastEventId = null, Union94? source = null, List<MessagePort> ports = null)

Parameters

type string
bubbles bool
cancelable bool
data dynamic
origin string
lastEventId string
source Union94?
ports List<MessagePort>

Returns

GlobalObject.Undefined