X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FAbstractWorker.html;h=151aa034a2abfc2e167919e358f8d238dbf5b581;hb=dab8c377b70fc962ec217f2aeb719842f9f94cd6;hp=388b91568f37a8f74f3a04cc4cbbcdb3faba48bf;hpb=3bd6a82e43e11294af91bbd19647944ac740169e;p=poolifier.git
diff --git a/docs/classes/AbstractWorker.html b/docs/classes/AbstractWorker.html
index 388b9156..151aa034 100644
--- a/docs/classes/AbstractWorker.html
+++ b/docs/classes/AbstractWorker.html
@@ -18,9 +18,9 @@
Type of main worker. Constructs a new poolifier worker. Whether this is the main worker or not. Function processed by the worker when the pool's Task function(s) processed by the worker when the pool's Reference to main worker. Options for the worker. Overrides AsyncResource.constructor Handler id of the Whether this is the main worker or not. Timestamp of the last task processed by this worker. Reference to main worker. Options for the worker. Task function(s) processed by the worker when the pool's The unique The unique Inherited from AsyncResource.asyncId Binds the given function to execute to this The returned function will have an v14.8.0, v12.19.0 The function to bind to the current Inherited from AsyncResource.bind Checks if the worker should be terminated, because its living too long. Checks if the Checks if the The function that should be defined. The task function(s) parameter that should be checked. Call all A reference to A reference to Inherited from AsyncResource.emitDestroy Returns the main worker. Reference to the main worker. Reference to the main worker. Gets the task function in the given scope. Name of the function that will be returned. Handles an error and convert it to a string so it can be sent back to the main worker. Message of the error. The error raised by the worker. Message of the error. Worker message listener. Message received. Function processed by the worker when the pool's Runs the given function synchronously. Function that will be executed. Input data for the given function. Runs the given function asynchronously. Function that will be executed. Input data for the given function. Call the provided function with the provided arguments in the execution context
of the async resource. This will establish the context, trigger the AsyncHooks
@@ -364,9 +359,9 @@ then restore the original execution context. v9.6.0Type Parameters
-
+
MainWorker extends Worker | MessagePort
@@ -60,21 +60,23 @@
last
Methods
constructor
-
Type Parameters
-
+
MainWorker extends Worker | MessagePort
fn: WorkerFunction<Data, Response>
-execution
function is invoked.taskFunctions: WorkerFunction<Data, Response> | TaskFunctions<Data, Response>
+execution
function is invoked. The first function is the default function.mainWorker: undefined | null | MainWorker
opts: WorkerOptions = ...
+opts: WorkerOptions = ...
Returns AbstractWorker<MainWorker, Data, Response>
Returns AbstractWorker<MainWorker, Data, Response>
-
Properties
-Protected
Optional
Readonly
alivealiveInterval
worker alive check.
-
-Protected
Readonly
is
-
-Protected
last
-
-Protected
main
-
-
+
Protected
Readonly
opts
-
+
+Protected
taskexecution
function is invoked.
+
Methods
async
-
Returns
asyncId
assigned to the resource.Returns number
Returns number
asyncId
assigned to the resource.
-
bind
-
    asyncResource: AsyncResource;
}AsyncResource
's scope.asyncResource
property referencing
-the AsyncResource
to which the function is bound.Since
Type Parameters
-
+
Func extends ((...args) => any)
AsyncResource
to which the function is bound.
fn: Func
AsyncResource
.Returns Func & {
    asyncResource: AsyncResource;
}Returns Func
-
Protected
check
-
Returns void
-
+Private
checkPrivate
check
-
fn
parameter is passed to the constructor.taskFunctions
parameter is passed to the constructor.Parameters
+fn: WorkerFunction<Data, Response>
-taskFunctions: WorkerFunction<Data, Response> | TaskFunctions<Data, Response>
+Returns void
-
Private
check
-
Parameters
opts: WorkerOptions
opts: WorkerOptions
Returns void
-
emit
-
destroy
hooks. This should only ever be called once. An error will
be thrown if it is called more than once. This must be manually called. If
the resource is left to be collected by the GC then the destroy
hooks will
never be called.Returns
asyncResource
.Returns AbstractWorker<MainWorker, Data, Response>
Returns AbstractWorker<MainWorker, Data, Response>
asyncResource
.
-
Protected
get
-
Returns
Returns MainWorker
Returns MainWorker
+
+Private
get
+
Parameters
+
+
+Optional
name: stringReturns WorkerFunction<Data, Response>
-
Protected
handle
-
Returns
Parameters
@@ -286,13 +305,14 @@ never be called.
e: string | Error
Returns string
Returns string
-
Protected
message
-
Parameters
message: MessageValue<Data, MainWorker>
+message: MessageValue<Data, MainWorker>
fn: WorkerFunction<Data, Response>
-execution
function is invoked.Returns void
-
-Protected
run
-
Parameters
-
-
fn: WorkerSyncFunction<Data, Response>
-message: MessageValue<Data, unknown>
-Returns void
-
Protected
run
-
Parameters
fn: WorkerAsyncFunction<Data, Response>
+fn: WorkerAsyncFunction<Data, Response>
message: MessageValue<Data, unknown>
+message: MessageValue<Data, Worker | MessagePort>
Returns void
-
run
-
Since
Type Parameters
-
+
This
Inherited from AsyncResource.runInAsyncScope
Protected
runRuns the given function synchronously.
+Function that will be executed.
+Input data for the given function.
+Protected
Abstract
sendSends a message to the main worker.
The response message.
The same triggerAsyncId
that is passed to the AsyncResource
constructor.
The same triggerAsyncId
that is passed to the AsyncResource
constructor.
Inherited from AsyncResource.triggerAsyncId
Static
bindBinds the given function to the current execution context.
-The returned function will have an asyncResource
property referencing
-the AsyncResource
to which the function is bound.
v14.8.0, v12.19.0
AsyncResource
to which the function is bound.
Optional
thisArg: ThisArgInherited from AsyncResource.bind
Base class that implements some shared logic for all poolifier workers.