Definition
HTML Standard defines MessagePort
[Exposed=(Window,Worker,AudioWorklet), Transferable]
interface MessagePort : EventTarget {
undefined postMessage(any message, sequence<object> transfer);
undefined postMessage(any message, optional StructuredSerializeOptions options = {});
undefined start();
undefined close();
// event handlers
attribute EventHandler onclose;
};
MessagePort includes MessageEventTarget;
Consolidated IDL (across mixin and partials)
[Exposed=(Window,Worker,AudioWorklet), Transferable]
interface MessagePort : EventTarget {
undefined postMessage(any message, sequence<object> transfer);
undefined postMessage(any message, optional StructuredSerializeOptions options = {});
undefined start();
undefined close();
// event handlers
attribute EventHandler onclose;
attribute EventHandler onmessage;
attribute EventHandler onmessageerror;
};
Methods and attributes that return objects implementing MessagePort
Referring IDL interfaces/dictionaries
Referring specifications
- Service Workers Nightly refers to
MessagePort
- Web Audio API 1.1 refers to
MessagePort