Asynchronous queue decouples value producers and value consumers.
+Asynchronous queue decouples value producers and value consumers.
Returns the number of values stored in this queue.
-Returns the number of values stored in this queue.
+Appends a new value to the end of the queue.
The value to append.
-Returns a promise that is fulfilled with a value when it is available.
+Returns a promise that is fulfilled with a value when it is available.
Values are taken in the same order they were appended. Taken values are removed from the queue.
The promise that is fulfilled with a value that was added to the queue. Aborting the returned promise after the value was taken is a no-op.
-Returns a promise that is fulfilled with a value and an acknowledgement callback.
+Returns a promise that is fulfilled with a value and an acknowledgement callback.
The promise is fulfilled when a value is available. Consequent consumers are blocked until the acknowledgement callback is invoked. Invoking acknowledgement callback multiple times is a no-op.
Note: Be sure to always call an acknowledgement callback. Otherwise, consequent consumers would never be @@ -22,4 +22,4 @@
A tuple that contains a value available in the queue, and a callback that acknowledges that the value was processed and should be removed from the queue. Aborting the returned promise after a consumer received an acknowledgement callback is a no-op.
-Provides mechanism for blocking async processes and unblocking them from an external context.
+Provides mechanism for blocking async processes and unblocking them from an external context.
true
if Blocker is blocked and wasn't unblocked yet, or false
otherwise.
true
if Blocker is blocked and wasn't unblocked yet, or false
otherwise.
Subscribes a listener to isBlocked status changes.
-The listener that would be notified.
-The callback to unsubscribe the listener.
-The promise that can be resolved externally.
+The promise that can be resolved externally.
Rejects the promise with the specified reason. If the promise has already been resolved, either to a value, +
Rejects the promise with the specified reason. If the promise has already been resolved, either to a value, a rejection, or another promise, this method does nothing.
-Rejects the promise with the specified reason. If the promise has already been resolved, either to a value, -a rejection, or another promise, this method does nothing.
-Optional
reason: anyThe rejection reason for the associated promise. Although the reason can be undefined, it is -generally an Error object, like in exception handling.
-Note: This argument should not be a promise. Specifying a rejected promise would make the rejection reason -equal to the rejected promise itself, and not its rejection reason.
-The rejection reason for the associated promise. Although the reason can be undefined, it is -generally an Error object, like in exception handling.
+Optional
reason: anyThe rejection reason for the associated promise. Although the reason can be undefined, it is +generally an Error object, like in exception handling.
Note: This argument should not be a promise. Specifying a rejected promise would make the rejection reason equal to the rejected promise itself, and not its rejection reason.
-Fulfills the promise with the specified value. If the promise has already been resolved, either to a value, +
Fulfills the promise with the specified value. If the promise has already been resolved, either to a value, a rejection, or another promise, this method does nothing.
-Fulfills the promise with the specified value. If the promise has already been resolved, either to a value, -a rejection, or another promise, this method does nothing.
-If this value is not a promise, including undefined
, it becomes the fulfillment value of the
-associated promise. If this value is a promise, then the associated promise will be resolved to the passed promise,
-and follow the state as the provided promise (including any future transitions).
If this value is not a promise, including undefined
, it becomes the fulfillment value of the
+
If this value is not a promise, including undefined
, it becomes the fulfillment value of the
associated promise. If this value is a promise, then the associated promise will be resolved to the passed promise,
and follow the state as the provided promise (including any future transitions).
Static
[species]Manages async callback execution process and provides ways to access execution results, abort or replace an -execution, and subscribe to its state changes.
-true
if the result was fulfilled with a value, or false
otherwise.
true
if the result was rejected with a reason, or false
otherwise.
The promise of the pending execution, or null
if there's no pending execution.
The reason of failure.
-The value or undefined
if rejected.
true
if an execution is currently pending, or false
otherwise.
true
if result was fulfilled or rejected, or false
otherwise.
Instantly aborts pending execution (if any), marks executor as pending and invokes the callback.
-If other execution was started before the promise returned by the callback is fulfilled then the signal is aborted -and the returned result is ignored.
-The callback that returns the new result for the executor to store.
-The promise that is resolved with the result of the callback execution.
-Promise-based lock implementation.
+Promise-based lock implementation.
When someone tries to acquire a Lock they receive a promise for a release callback that is fulfilled as soon as previous lock owner invokes their release callback.
https://en.wikipedia.org/wiki/Lock_(computer_science) Lock (computer science)
-true
if Lock was acquired and wasn't released yet.
Subscribes a listener to the isLocked status changes.
-The listener that would be notified.
-The callback to unsubscribe the listener.
-true
if Lock was acquired and wasn't released yet.
Publish–subscribe pattern implementation that guarantees the delivery of published messages even if any of listeners +
Publish–subscribe pattern implementation that guarantees the delivery of published messages even if any of listeners would throw an error.
The number of subscribed listeners.
+Synchronously invokes listeners with the published message.
The published message.
-Adds a listener that would receive all messages published via publish.
+The callback execution pool that can execute limited number of callbacks in parallel while other submitted callbacks +
The callback execution pool that can execute limited number of callbacks in parallel while other submitted callbacks wait in the queue.
-The number of active workers in the pool.
-Aborts all pending jobs and returns promise that is fulfilled when all workers are terminated.
+The number of active workers in the pool.
+Aborts all pending jobs and returns promise that is fulfilled when all workers are terminated.
This operation preserves the size of the pool intact.
Optional
reason: anyThe reason that is used to reject all pending job promises.
The promise that is fulfilled when all workers are terminated.
-Changes the size of the pool by spawning or terminating workers. If the size of the pool is reduced, then +
Changes the size of the pool by spawning or terminating workers. If the size of the pool is reduced, then corresponding workers are terminated and if they were processing jobs, those jobs are instantly aborted.
The new size of the pool.
Optional
reason: anyThe reason that is used to reject pending job promises that are processed by terminated workers. Only applicable if the pool is downsized.
The promise that is fulfilled when the number of workers matches the requested size: excessive workers were deleted or additional workers were spawned.
-Submits a new callback that should be executed by the worker in the pool.
+Submits a new callback that should be executed by the worker in the pool.
The callback to invoke.
The promise that is fulfilled with the callback result.
-Returns a promise that is fulfilled with undefined
after a timeout elapses.
Returns a promise that is fulfilled with undefined
after a timeout elapses.
The timeout in milliseconds after which the returned promise is fulfilled.
The promise that is fulfilled after a timeout.
-Returns a promise that is fulfilled with a value after a timeout elapses.
+Returns a promise that is fulfilled with a value after a timeout elapses.
The promise that is fulfilled with the value after the timeout elapses.
-Invokes a callback periodically with the given delay between settlements of returned promises until the condition is +
Invokes a callback periodically with the given delay between fulfillment of returned promises until the condition is met. If callback throws an error or returns a rejected promise, then the promise returned from repeat is rejected.
The callback that is periodically invoked.
-The number of milliseconds between the settlement of the last promise returned by the callback and the +
The callback that is periodically invoked.
+The number of milliseconds between the settlement of the last promise returned by the callback and the next invocation. Or a callback that receives the latest result and returns the delay. If omitted then delay is 0.
The callback that should return true
to terminate the loop, or false
to proceed to the next
iteration. The condition is checked before the next iteration is scheduled. If omitted then loop is repeated
indefinitely.
The promise that is fulfilled with the callback result.
-Invokes a callback periodically with the given delay between settlements of returned promises until the condition is +
Invokes a callback periodically with the given delay between fulfillment of returned promises until the condition is met. If callback throws an error or returns a rejected promise, then the promise returned from repeat is rejected.
The callback that is periodically invoked.
-Optional
ms: number | ((value, index) => number)The number of milliseconds between the settlement of the last promise returned by the callback and the next +
The callback that is periodically invoked.
+Optional
ms: number | ((value, index) => number)The number of milliseconds between the settlement of the last promise returned by the callback and the next invocation. Or a callback that receives the latest result and returns the delay. If omitted then delay is 0.
Optional
until: ((value, index) => unknown)The callback that should return truthy value to terminate the loop, or falsy to proceed to the next iteration. The condition is checked before the next iteration is scheduled. If omitted then loop is repeated indefinitely.
The promise that is fulfilled with the callback result.
-Invokes a callback periodically until it successfully returns the result. If a callback throws an error or returns +a promise that is rejected then it is invoked again after a delay.
+The callback that must return the fulfilled result.
+Optional
ms: number | ((error, index) => number)The number of milliseconds between the rejection of the last promise returned by the callback and the next +invocation. Or a callback that receives the latest error and returns the delay. If omitted then delay is 0.
+Optional
maxCount: numberThe maximum number of retries after which the last rejection reason is thrown.
+The promise that is fulfilled with the callback result.
+Returns a promise that is fulfilled with a produced value, or rejected after the timeout elapses.
+Returns a promise that is fulfilled with a produced value, or rejected after the timeout elapses.
A callback that receives a signal that is aborted if the timeout elapses, or a promise-like object.
The timeout after which the returned promise is rejected.
The promise that is fulfilled before a timeout elapses, or rejected with a TimeoutError.
-Polls the callback until it returns a truthy value or rejects.
+Polls the callback until it returns a truthy value or rejects.
The callback that is periodically invoked.
-Optional
ms: number | ((value, index) => number)The number of milliseconds between the settlement of the last promise returned by the callback and the next +
The callback that is periodically invoked.
+Optional
ms: number | ((value, index) => number)The number of milliseconds between the settlement of the last promise returned by the callback and the next invocation. Or a callback that receives the latest value and returns the delay. If omitted then delay is 0.
The truthy value.
-The callback that receives a signal that is aborted when execution must be stopped, and returns the execution value.
+The callback that receives a signal that is aborted when execution must be stopped, and returns the execution value.
The protocol provided to the AsyncQueue consumer, so it can acknowledge that the value was processed and +
The protocol provided to the AsyncQueue consumer, so it can acknowledge that the value was processed and should be removed from the queue.
The promise that can be aborted.
+- Preparing search index...
- The search index is not available
parallel-universe - v6.0.0Class AbortablePromise<T>
The promise that can be aborted.
Type Parameters
The value that the promise is resolved with.
-Hierarchy
Index
Constructors
Methods
Constructors
constructor
Creates a new abortable promise.
+Hierarchy
Index
Constructors
Accessors
Methods
Constructors
constructor
Creates a new abortable promise.
Type Parameters
The value that the promise is resolved with.
Parameters
A callback that initializes the promise.
Parameters
The resolve callback used to resolve the promise with a value or the result of another promise.
@@ -11,10 +12,10 @@Parameters
Returns void
The reject callback used to reject the promise with a provided reason or error.
Param: reason
The rejection reason.
Parameters
Optional
reason: anyReturns void
The signal that is aborted if abort method is called.
-Returns void
Returns AbortablePromise<T>
Methods
abort
Aborts the signal passed to the executor and instantly rejects the promise with the reason.
-Parameters
Optional
reason: anyThe abort reason. If not explicitly provided, it defaults to an +
Returns void
Returns AbortablePromise<T>
Accessors
Static
[species]Returns PromiseConstructor
Methods
abort
Aborts the signal passed to the executor and instantly rejects the promise with the reason.
+Parameters
Optional
reason: unknownThe abort reason. If not explicitly provided, it defaults to an AbortError.
-Returns void
with Signal
Subscribes this promise to be aborted when the signal is aborted.
+Returns void
with Signal
Subscribes this promise to be aborted when the signal is aborted.
Parameters
The signal that aborts this promise.
Returns this
This promise.
-Settings
Member Visibility
Theme
On This Page