X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=docs%2Fclasses%2FAbstractWorker.html;h=fe134d40e6321a910816c6ed24aabc2cbe49f7c7;hb=ab80dc4621654ddd6f327ffec8db9a425e56e6d1;hp=88a908c324ef4646e4e540fe10094abc103cee58;hpb=f1583b4edd427f8c3f2b4ddc652d2e102390b08e;p=poolifier.git diff --git a/docs/classes/AbstractWorker.html b/docs/classes/AbstractWorker.html index 88a908c3..fe134d40 100644 --- a/docs/classes/AbstractWorker.html +++ b/docs/classes/AbstractWorker.html @@ -1,13 +1,15 @@ -AbstractWorker | poolifier
+AbstractWorker | poolifier
-
+
-
+
  • 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,318 +55,351 @@

    Constructors

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

        -
        +

        Type Parameters

        -
          +
          • -

            MainWorker extends Worker | MessagePort

          • +

            MainWorker extends Worker | MessagePort

          • -

            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

    • +
      taskFunctions: WorkerFunction<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.

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

      Reference to main worker.

      -
    • +
    +
  • -
    opts: WorkerOptions = ...
    +
    opts: WorkerOptions = ...

    Options for the worker.

    -
  • -

    Returns AbstractWorker<MainWorker, Data, Response>

    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.

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

    Options for the worker.

    -
    +
    + +
    statistics: WorkerStatistics
    +

    Performance statistics computation requirements.

    +
    +
    +
  • Defined in src/worker/abstract-worker.ts:50
  • +
    + +
    taskFunctions: Map<string, WorkerFunction<Data, Response>>
    +

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

    +
    +

    Methods

    -
    - -
    +
    + +
    +
    + +

    Parameters

    -

    Returns Func & { asyncResource: AsyncResource }

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

    Returns void

    +
    -
    - -
    +
    + +

    Returns void

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

    Returns TaskPerformance

    -
    - -
    +
    + +
    +
    + + -

    Returns void

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

    Input data for the given function.

    -
  • -

    Returns void

    -
    - -
    +
    + + +

    Returns void

    +
    -
    - -
    +
    + +

    Parameters

    +

    Returns Result

  • -
    Optional thisArg: This
    +
    Optional thisArg: This

    The receiver to be used for the function call.

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

    Optional arguments to pass to the function.

    -
  • -

    Returns Result

    +
    + +
    +
    + + +

    Returns void

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

    Parameters

    +
  • -
    Optional type: string
    +
    Optional type: string

    An optional name to associate with the underlying AsyncResource.

    -
  • + +
  • -
    Optional thisArg: ThisArg
  • -

    Returns Func & { asyncResource: AsyncResource }

    +
    +
    +
    +

    On This Page

    - -
    +
  • constructor
  • +
  • aliveInterval
  • +
  • isMain
  • +
  • lastTaskTimestamp
  • +
  • mainWorker
  • +
  • opts
  • +
  • statistics
  • +
  • taskFunctions
  • +
  • asyncId
  • +
  • beginTaskPerformance
  • +
  • bind
  • +
  • checkAlive
  • +
  • checkStatistics
  • +
  • checkTaskFunctions
  • +
  • checkWorkerOptions
  • +
  • emitDestroy
  • +
  • endTaskPerformance
  • +
  • getMainWorker
  • +
  • getTaskFunction
  • +
  • handleError
  • +
  • messageListener
  • +
  • runAsync
  • +
  • runInAsyncScope
  • +
  • runSync
  • +
  • sendToMainWorker
  • +
  • triggerAsyncId
  • +
  • bind
  • + +

    Generated using TypeDoc

    -
    \ No newline at end of file +
    \ No newline at end of file