WorkerPool

Helper class to push actions to a pool of workers.

Hierarchy

  • WorkerPool

Implements

Index

Constructors

Methods

Constructors

constructor

  • new WorkerPool(workers: Array<Worker>): WorkerPool
  • Constructor

    Parameters

    • workers: Array<Worker>

      Array of workers to use for actions

    Returns WorkerPool

Methods

dispose

  • dispose(): void
  • Terminates all workers and clears any pending actions.

    Returns void

push

  • push(action: function): void
  • Pushes an action to the worker pool. If all the workers are active, the action will be pended until a worker has completed its action.

    Parameters

    • action: function

      The action to perform. Call onComplete when the action is complete.

        • (worker: Worker, onComplete: function): void
        • Parameters

          • worker: Worker
          • onComplete: function
              • (): void
              • Returns void

          Returns void

    Returns void

Generated using TypeDoc