CodeMeltedDEV
    Preparing search index...

    Function async_worker

    • Creates an background worker to offload processing to a background thread.

      Parameters

      • params: {
            name: string;
            options?: CWorkerOptions;
            rx_handler: CProtocolEventHandler<CWorkerEvent>;
            url: string;
        }

        The named parameters.

        • name: string

          The optional name to give to the protocol.

        • Optionaloptions?: CWorkerOptions

          Options for further configuration of the worker. Defaults to a "module" type.

        • rx_handler: CProtocolEventHandler<CWorkerEvent>

          The receive handler for data and state changes.

        • url: string

          The URL associated with the worker thread.

      Returns CWorkerProtocol

      // Build a worker for a dedicated background thread
      if (runtime_availability({request: AVAILABILITY_REQUEST.WorkerAvailable})) {
      const worker = async_worker({
      name: "worker",
      rx_handler: (evt) => { },
      url: "./worker.js"
      });
      }

      // Later when done
      worker.terminate();