Constructor
new TaskStackAsync(listenernon-null, running_limitopt, queued_limitopt)
Create a new TaskStackAsync
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
listener | Stacklistener | listener for task results | ||
running_limit | number | <optional> | 16 | number of tasks that can be running at a time (e.g. TaskLimiter#running_limit) |
queued_limit | number | <optional> | Infinity | number of tasks that can be queued at a time (e.g. TaskLimiter#queued_limit) |
- Source
Classes
Members
limiter :TaskLimiter
Limiter for simultaneous running tasks
- Source
(non-null) listener :StackListener
Listener for results
- Source
Methods
(async) add(task, …args) → {Promise}
Add an ordered task to the stack
Name | Type | Attributes | Description |
---|---|---|---|
task | Promise | | Running promise or function (if promise is already running, the limit config option may not be respected) | |
args | any | <repeatable> | Arguments to pass to the TaskStackAsync#listener (not the task!) |
- Source
a promise resolving when the underlying TaskLimiter unblocks
- Type:
- Promise
empty() → {Promise}
Returns promise which resolves when stack is empty
- Source
- Type:
- Promise