Variable workerModuleConst

workerModule: {
    isRunningInWorker() => boolean;
    sleep(ms) => void;
    transferBuffer(data) => TransferDescriptor<ArrayBuffer>;
} = ...

Worker object that contains all functions that will be executed in parallel Functions should be using CPU-parallelism not IO-parallelism Most functions should be synchronous, not asynchronous Making them asynchronous does not make a difference to the caller The caller must always await because the functions will run on the pool

Type declaration

  • isRunningInWorker:function
    • Check if we are running in the worker. Only used for testing

      Returns boolean

  • sleep:function
    • Sleep synchronously This blocks the entire event loop Only used for testing

      Parameters

      • ms: number

      Returns void

  • transferBuffer:function
    • Zero copy demonstration manipulating buffers

      Parameters

      • data: ArrayBuffer

      Returns TransferDescriptor<ArrayBuffer>

Generated using TypeDoc