Baseline Widely available
Note: This feature is only available in Service Workers.
The ExtendableMessageEvent()
constructor creates a new ExtendableMessageEvent
object.
new ExtendableMessageEvent(type)
new ExtendableMessageEvent(type, options)
Parameters
type
A string with the name of the event. It is case-sensitive and browsers set it to messageerror
or message
.
options
Optional
An object that, in addition of the properties defined in ExtendableEvent()
, can have the following properties:
data
Optional
The event's data; this can be any data type. It defaults to null
.
origin
Optional
A string that defines the origin of the corresponding service worker's environment settings object. It defaults to ""
.
lastEventId
Optional
A string that defines the last event ID of the event source. It defaults to ""
.
source
Optional
The Client
, ServiceWorker
or MessagePort
that sent the message. It defaults to null
.
ports
Optional
An array containing the MessagePort
objects connected to the channel sending the message. It defaults to an empty array.
A new ExtendableMessageEvent
object.
const options = {
data: "hello message",
source: MessagePortReference,
ports: MessagePortListReference,
};
const myEME = new ExtendableMessageEvent("message", init);
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