MessageEvent
A message received by a target object.
interface MessageEvent <T = any> extends Event {
readonly data: T;
readonly lastEventId: string;
readonly origin: string;
readonly ports: ReadonlyArray<MessagePort>;
readonly source: MessageEventSource | null;
initMessageEvent(
type: string,
bubbles?: boolean,
cancelable?: boolean,
data?: any,
origin?: string,
lastEventId?: string,
source?: MessageEventSource | null,
ports?: MessagePort[],
): void;initMessageEvent(
}type: string,
bubbles?: boolean,
cancelable?: boolean,
data?: any,
origin?: string,
lastEventId?: string,
source?: MessageEventSource | null,
ports?: Iterable<MessagePort>,
): void;var MessageEvent: {
prototype: MessageEvent;
new <T>(type: string, eventInitDict?: MessageEventInit<T>): MessageEvent<T>;
};§Properties
§
readonly origin: string
[src]Returns the origin of the message, for server-sent events and cross-document messaging.
§
readonly ports: ReadonlyArray<MessagePort>
[src]Returns the MessagePort array sent with the message, for cross-document messaging and channel messaging.
§
readonly source: MessageEventSource | null
[src]Returns the WindowProxy of the source window, for cross-document messaging, and the MessagePort being attached, in the connect event fired at SharedWorkerGlobalScope objects.
§Methods
§
initMessageEvent(
[src]type: string,
bubbles?: boolean,
cancelable?: boolean,
data?: any,
origin?: string,
lastEventId?: string,
source?: MessageEventSource | null,
ports?: MessagePort[],
): void§
initMessageEvent(
[src]type: string,
bubbles?: boolean,
cancelable?: boolean,
data?: any,
origin?: string,
lastEventId?: string,
source?: MessageEventSource | null,
ports?: Iterable<MessagePort>,
): void