X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FAbstractWorker.html;h=2d8dfa499b03c9a01becfa39d87a2b8cb4e3a410;hb=b22361f4474e4a63a7482741d98f0c58b4b03b4c;hp=842c682e1c6ca46882a42ce47df365b6193d0dd0;hpb=ab03ecdd9c195574f19dbed3b36641229c24f723;p=poolifier.git diff --git a/docs/classes/AbstractWorker.html b/docs/classes/AbstractWorker.html index 842c682e..2d8dfa49 100644 --- a/docs/classes/AbstractWorker.html +++ b/docs/classes/AbstractWorker.html @@ -1,556 +1,128 @@ -AbstractWorker | poolifier
-
- -
-
-
-
- -

Class AbstractWorker<MainWorker, Data, Response>Abstract

-
-

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

-
-
-

Type Parameters

-
    -
  • -

    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.

    -
  • -
  • -

    Response = unknown

    -

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

    -
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
- -
    - -
  • -

    Constructs a new poolifier worker.

    -
    -
    -

    Type Parameters

    -
      -
    • -

      MainWorker extends Worker | MessagePort

    • -
    • -

      Data = unknown

    • -
    • -

      Response = unknown

    -
    -

    Parameters

    -
      -
    • -
      type: string
      -

      The type of async event.

      -
    • -
    • -
      isMain: boolean
      -

      Whether this is the main worker or not.

      -
    • -
    • -
      fn: WorkerFunction<Data, Response>
      -

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

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

      Reference to main worker.

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

      Options for the worker.

      -
    -

    Returns AbstractWorker<MainWorker, Data, Response>

-
-

Properties

-
- -
aliveInterval?: Timeout
-

Handler id of the aliveInterval worker alive check.

-
-
- -
isMain: boolean
-

Whether this is the main worker or not.

-
-
- -
lastTaskTimestamp: number
-

Timestamp of the last task processed by this worker.

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

Reference to main worker.

-
-
- -
opts: WorkerOptions = ...
-

Options for the worker.

-
-
-

Methods

-
- -
    - -
  • -
    -

    Returns

    The unique asyncId assigned to the resource.

    -
    -

    Returns number

-
- -
    - -
  • -

    Binds the given function to execute to this AsyncResource's scope.

    -

    The returned function will have an asyncResource property referencing -the AsyncResource to which the function is bound.

    - -

    Since

    v14.8.0, v12.19.0

    -
    -
    -

    Type Parameters

    -
      -
    • -

      Func extends ((...args: any[]) => any)

    -
    -

    Parameters

    -
      -
    • -
      fn: Func
      -

      The function to bind to the current AsyncResource.

      -
    -

    Returns Func & {
        asyncResource: AsyncResource;
    }

-
- -
-
- -
-
- -
-
- -
  • Returns number

    The same triggerAsyncId that is passed to the AsyncResource constructor.

    +
  • Binds the given function to the current execution context.

    +

    Type Parameters

    • Func extends ((this, ...args) => any)

    • ThisArg

    Parameters

    • fn: Func

      The function to bind to the current execution context.

      +
    • Optional type: string

      An optional name to associate with the underlying AsyncResource.

      +
    • Optional thisArg: ThisArg

    Returns Func

    Since

    v14.8.0, v12.19.0

    +

Generated using TypeDoc

\ No newline at end of file