A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://developer.mozilla.org/en-US/docs/Web/API/MessageEvent/MessageEvent below:

MessageEvent: MessageEvent() constructor - Web APIs

MessageEvent: MessageEvent() constructor

Baseline Widely available

Note: This feature is available in Web Workers.

The MessageEvent() constructor creates a new MessageEvent object.

Syntax
new MessageEvent(type)
new MessageEvent(type, options)
Parameters
type

A string with the name of the event. It is case-sensitive and browsers always set it to message.

options Optional

An object that, in addition of the properties defined in Event(), can have the following properties:

data Optional

The data you want contained in the MessageEvent. This can be of any data type, and will default to null if not specified.

origin Optional

A string representing the origin of the message emitter. This defaults to an empty string ('') if not specified.

lastEventId Optional

A string representing a unique ID for the event. This defaults to an empty string ("") if not specified.

source Optional

A MessageEventSource (which can be a Window, a MessagePort, or a ServiceWorker object) representing the message emitter. This defaults to null if not set.

ports Optional

An array of MessagePort objects containing all MessagePort objects sent with the message, in order. This defaults to an empty array ([]) if not specified.

Return value

A new MessageEvent object.

Examples
const myMessage = new MessageEvent("message", {
  data: "hello",
});
Specifications Browser compatibility See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4