X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FAbstractWorker.html;h=c2f2854f3ae42c55cd233b0c119469fea9f4c1a0;hb=3f98807908292d0cf91347a9f95e3b2572703337;hp=c048f6f6d26cf39f0563493cec0eeffa622a122d;hpb=e83f3916315e18f3ca0c614d6ec9e064ab76c13c;p=poolifier.git diff --git a/docs/classes/AbstractWorker.html b/docs/classes/AbstractWorker.html index c048f6f6..c2f2854f 100644 --- a/docs/classes/AbstractWorker.html +++ b/docs/classes/AbstractWorker.html @@ -1,13 +1,15 @@ -AbstractWorker | poolifier
+AbstractWorker | poolifier - v2.6.37
-
+
  • The search index is not available
  • poolifier - v2.6.37 +
    -
    +
    • poolifier
    • @@ -15,33 +17,37 @@

      Class AbstractWorker<MainWorker, Data, Response>Abstract

    Base class that implements some shared logic for all poolifier workers.

    -
    -
    +
    +
    +

    Type Parameters

    -
      +
      • -

        MainWorker extends Worker | MessagePort

        +

        MainWorker extends Worker | MessagePort

        Type of main worker.

        -
      • +
    +
  • -

    Data = unknown

    -

    Type of data this worker receives from pool's execution. This can only be serializable data.

    -
  • +

    Data = unknown

    +

    Type of data this worker receives from pool's execution. This can only be structured-cloneable data.

    +
    +
  • -

    Response = unknown

    -

    Type of response the worker sends back to the main worker. This can only be serializable data.

    -
  • +

    Response = unknown

    +

    Type of response the worker sends back to the main worker. This can only be structured-cloneable data.

    +
    +

    Hierarchy

    @@ -49,465 +55,771 @@

    Constructors

    -
    - -
      - +
      + +
        +
      • Constructs a new poolifier worker.

        -
        +

        Type Parameters

        -
          +
          • -

            MainWorker extends Worker | MessagePort

          • +

            MainWorker extends MessagePort | Worker

          • -

            Data = unknown

          • +

            Data = unknown

          • -

            Response = unknown

        +

        Response = unknown

      Parameters

      • -
        type: string
        +
        type: string

        The type of async event.

      • -
        isMain: boolean
        +
        isMain: boolean

        Whether this is the main worker or not.

      • -
        fn: ((data: Data) => Response)
        -

        Function processed by the worker when the pool's execution function is invoked.

        -
        -
          -
        • -
            -
          • (data: Data): Response
          • -
          • -
            -

            Parameters

            -
              -
            • -
              data: Data
            -

            Returns Response

      • -
      • -
        mainWorker: undefined | null | MainWorker
        +
        mainWorker: MainWorker

        Reference to main worker.

      • -
        opts: WorkerOptions = ...
        +
        taskFunctions: TaskFunction<Data, Response> | TaskFunctions<Data, Response>
        +

        Task function(s) processed by the worker when the pool's execution function is invoked. The first function is the default function.

        +
      • +
      • +
        opts: WorkerOptions = DEFAULT_WORKER_OPTIONS

        Options for the worker.

      -

      Returns AbstractWorker<MainWorker, Data, Response>

    +
  • Defined in src/worker/abstract-worker.ts:83
  • Properties

    -
    - -
    aliveInterval?: Timeout
    -

    Handler Id of the aliveInterval worker alive check.

    -
    +
    + +
    lastTaskTimestamp: number

    Timestamp of the last task processed by this worker.

    -
    +
    -
    - -
    mainWorker: undefined | null | MainWorker
    +
    + +
    mainWorker: MainWorker
    +

    Reference to main worker.

    +
    +
    -
    - -
    opts: WorkerOptions
    +
  • Defined in src/worker/abstract-worker.ts:86
  • +
    + +
    opts: WorkerOptions = DEFAULT_WORKER_OPTIONS

    Options for the worker.

    -
    +
  • Defined in src/worker/abstract-worker.ts:88
  • +
    + +
    statistics: WorkerStatistics
    +

    Performance statistics computation requirements.

    +
    +
    +
    + +
    taskFunctions: Map<string, TaskFunction<Data, Response>>
    +

    Task function(s) processed by the worker when the pool's execution function is invoked.

    +
    +

    Methods

    -
    - -
    +
    + +
    +
    + +

    Parameters

    -

    Returns Func & { asyncResource: AsyncResource }

    -
    - -
    +
    + +
    -
    - -
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + + +
    name: string
    +
  • +
    fn: TaskFunction<Data, Response>
  • Returns void

    -
    - -
    +
    + +

    Returns void

    -
    - -
    +
    + +
    -
    - -
    +
    + +
    +
    + +
    -
    - -
    +
    + +
    -
    - -
    +
    + +
    +
    + + -

    Returns void

    -
    - -
    +
    + +
    +
    + +
    +
    + + -
  • -
    value: MessageValue<Data, unknown>
    -

    Input data for the given function.

    +
    message: MessageValue<Data, unknown>
    +

    The received message.

  • -

    Returns void

    -
    - -
    +
    + +
    +
    + +
    +
    + + +
    fn: TaskAsyncFunction<Data, Response>
    +

    Task function that will be executed.

    +
  • -
    value: MessageValue<Data, unknown>
    -

    Input data for the given function.

    +
    task: Task<Data>
    +

    Input data for the task function.

  • -

    Returns void

    -
    - -
    +
    + +

    Parameters

    +

    Returns Result

  • -
    Optional thisArg: This
    +
    Optional thisArg: This

    The receiver to be used for the function call.

    -
  • +Optional
  • -
    Rest ...args: any[]
    +
    Rest ...args: any[]

    Optional arguments to pass to the function.

    -
  • -

    Returns Result

    +
    + +
    +
    + +
    +
    + +
    -
    - -
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    -
    - -
    +
    + +
    +
    + +

    Parameters

    Optional
  • -
    Optional thisArg: ThisArg
  • -

    Returns Func & { asyncResource: AsyncResource }

    +
    +
    +
    +

    On This Page

    - -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +
  • constructor
  • +
  • activeInterval
  • +
  • id
  • +
  • isMain
  • +
  • lastTaskTimestamp
  • +
  • mainWorker
  • +
  • opts
  • +
  • statistics
  • +
  • taskFunctions
  • +
  • addTaskFunction
  • +
  • asyncId
  • +
  • beginTaskPerformance
  • +
  • bind
  • +
  • checkActive
  • +
  • checkMessageWorkerId
  • +
  • checkStatistics
  • +
  • checkTaskFunctionName
  • +
  • checkTaskFunctions
  • +
  • checkValidTaskFunction
  • +
  • checkWorkerOptions
  • +
  • emitDestroy
  • +
  • endTaskPerformance
  • +
  • getMainWorker
  • +
  • handleError
  • +
  • handleKillMessage
  • +
  • handleReadyMessage
  • +
  • hasTaskFunction
  • +
  • listTaskFunctions
  • +
  • messageListener
  • +
  • removeTaskFunction
  • +
  • run
  • +
  • runAsync
  • +
  • runInAsyncScope
  • +
  • runSync
  • +
  • sendTaskFunctionsListToMainWorker
  • +
  • sendToMainWorker
  • +
  • setDefaultTaskFunction
  • +
  • startCheckActive
  • +
  • stopCheckActive
  • +
  • triggerAsyncId
  • +
  • updateLastTaskTimestamp
  • +
  • bind
  • + +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file