Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Type aliases

TransferListItem

TransferListItem: ArrayBuffer | MessagePort | FileHandle

Variables

Const SHARE_ENV

SHARE_ENV: keyof symbol

Const isMainThread

isMainThread: boolean

Const parentPort

parentPort: null | MessagePort

Const resourceLimits

resourceLimits: ResourceLimits

Const threadId

threadId: number

Const workerData

workerData: any

Functions

markAsUntransferable

  • markAsUntransferable(object: object): void
  • Mark an object as not transferable. If object occurs in the transfer list of a port.postMessage() call, it will be ignored.

    In particular, this makes sense for objects that can be cloned, rather than transferred, and which are used by other objects on the sending side. For example, Node.js marks the ArrayBuffers it uses for its Buffer pool with this.

    This operation cannot be undone.

    Parameters

    • object: object

    Returns void

moveMessagePortToContext

  • Transfer a MessagePort to a different vm Context. The original port object will be rendered unusable, and the returned MessagePort instance will take its place.

    The returned MessagePort will be an object in the target context, and will inherit from its global Object class. Objects passed to the port.onmessage() listener will also be created in the target context and inherit from its global Object class.

    However, the created MessagePort will no longer inherit from EventEmitter, and only port.onmessage() can be used to receive events using it.

    Parameters

    Returns MessagePort

receiveMessageOnPort

  • receiveMessageOnPort(port: MessagePort): object | undefined
  • Receive a single message from a given MessagePort. If no message is available, undefined is returned, otherwise an object with a single message property that contains the message payload, corresponding to the oldest message in the MessagePort’s queue.

    Parameters

    Returns object | undefined

Generated using TypeDoc