WorldPort beta
Interface of @v12-engine/engine
ts
export interface WorldPortWhere a worker hears and answers: a page's worker scope, or Node's parentPort
Members
addEventListener
ts
addEventListener?(type: 'message', listener: (event: {
data: unknown;
}) => void): void;Listens for the page's messages, where the port is a worker scope
on
ts
on?(type: 'message', listener: (value: unknown) => void): void;Listens for the page's messages, where the port is Node's parentPort
postMessage
ts
postMessage(message: unknown, transfer?: unknown[]): void;Sends a message to the page, with objects to transfer rather than copy