MessagePort
Defined in: .pnpm-home/store/v11/links/@cloudflare/workers-types/4.20251118.0/2891147a4db443bf13ca098dcb7381fb6bac5793758b7fd187ebaf5bc0deb969/node_modules/@cloudflare/workers-types/index.ts:3629
The MessagePort interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.
Extends
Section titled “Extends”Accessors
Section titled “Accessors”onmessage
Section titled “onmessage”Get Signature
Section titled “Get Signature”get onmessage():
any
Defined in: .pnpm-home/store/v11/links/@cloudflare/workers-types/4.20251118.0/2891147a4db443bf13ca098dcb7381fb6bac5793758b7fd187ebaf5bc0deb969/node_modules/@cloudflare/workers-types/index.ts:3651
Returns
Section titled “Returns”any
Set Signature
Section titled “Set Signature”set onmessage(
value):void
Defined in: .pnpm-home/store/v11/links/@cloudflare/workers-types/4.20251118.0/2891147a4db443bf13ca098dcb7381fb6bac5793758b7fd187ebaf5bc0deb969/node_modules/@cloudflare/workers-types/index.ts:3652
Parameters
Section titled “Parameters”any
Returns
Section titled “Returns”void
Methods
Section titled “Methods”addEventListener()
Section titled “addEventListener()”addEventListener<
Type>(type,handler,options?):void
Defined in: .pnpm-home/store/v11/links/@cloudflare/workers-types/4.20251118.0/2891147a4db443bf13ca098dcb7381fb6bac5793758b7fd187ebaf5bc0deb969/node_modules/@cloudflare/workers-types/index.ts:878
The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
Type Parameters
Section titled “Type Parameters”Type extends string
Parameters
Section titled “Parameters”Type
handler
Section titled “handler”EventListenerOrEventListenerObject<Event>
options?
Section titled “options?”boolean | EventTargetAddEventListenerOptions
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”close()
Section titled “close()”close():
void
Defined in: .pnpm-home/store/v11/links/@cloudflare/workers-types/4.20251118.0/2891147a4db443bf13ca098dcb7381fb6bac5793758b7fd187ebaf5bc0deb969/node_modules/@cloudflare/workers-types/index.ts:3644
The close() method of the MessagePort interface disconnects the port, so it is no longer active.
Returns
Section titled “Returns”void
dispatchEvent()
Section titled “dispatchEvent()”dispatchEvent(
event):boolean
Defined in: .pnpm-home/store/v11/links/@cloudflare/workers-types/4.20251118.0/2891147a4db443bf13ca098dcb7381fb6bac5793758b7fd187ebaf5bc0deb969/node_modules/@cloudflare/workers-types/index.ts:898
The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”postMessage()
Section titled “postMessage()”postMessage(
data?,options?):void
Defined in: .pnpm-home/store/v11/links/@cloudflare/workers-types/4.20251118.0/2891147a4db443bf13ca098dcb7381fb6bac5793758b7fd187ebaf5bc0deb969/node_modules/@cloudflare/workers-types/index.ts:3635
The postMessage() method of the transfers ownership of objects to other browsing contexts.
Parameters
Section titled “Parameters”any
options?
Section titled “options?”any[] | MessagePortPostMessageOptions
Returns
Section titled “Returns”void
removeEventListener()
Section titled “removeEventListener()”removeEventListener<
Type>(type,handler,options?):void
Defined in: .pnpm-home/store/v11/links/@cloudflare/workers-types/4.20251118.0/2891147a4db443bf13ca098dcb7381fb6bac5793758b7fd187ebaf5bc0deb969/node_modules/@cloudflare/workers-types/index.ts:888
The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.
Type Parameters
Section titled “Type Parameters”Type extends string
Parameters
Section titled “Parameters”Type
handler
Section titled “handler”EventListenerOrEventListenerObject<Event>
options?
Section titled “options?”boolean | EventTargetEventListenerOptions
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”EventTarget.removeEventListener
start()
Section titled “start()”start():
void
Defined in: .pnpm-home/store/v11/links/@cloudflare/workers-types/4.20251118.0/2891147a4db443bf13ca098dcb7381fb6bac5793758b7fd187ebaf5bc0deb969/node_modules/@cloudflare/workers-types/index.ts:3650
The start() method of the MessagePort interface starts the sending of messages queued on the port.
Returns
Section titled “Returns”void