Function workerInit

  • Initialization function for script-based worker threads

    Example

    // worker.js
    import { workerInit } from 'nanothreads';

    workerInit(self, (a, b) => a + b);

    See

    Thread to see how to create the worker thread

    Type Parameters

    • Args extends unknown

    • Output

    Parameters

    • target: typeof globalThis | MessagePort
    • func: WorkerThreadFn<Args, Output>

    Returns void

Generated using TypeDoc