Constructor
new PromiseQueue(options)
PromiseQueue constructor
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
Members
size
PromiseQueue size getter.
Methods
abort()
Abort all non-executed Promises in the queue.
add(fn, options) → {Promise}
Add a Promise to the queue, if the queue is empty it will be executed immediately, else it will wait for the other Promises to resolve/reject.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
fn |
function | Wrapper function which should return a Promise |
||||||
options |
Object |
Properties
|
Returns:
- Type
- Promise
remove(fn, rejectopt)
Remove a Promise from the PromiseQueue
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
fn |
function | Wrapper function which should return a Promise |
|
reject |
boolean |
<optional> |
If undefined the Promise to be removed will be rejected |