Docs (4.0.0)
class AsyncTaskQueue method

waitAsync

Waits until the number of pending tasks is equal to or lower than a specified count (or zero).

waitAsync(count?: number): Promise<void>

Notes

  • This method is typically used to wait for a queue to be empty, i.e. when all tasks have completed. It can also be used as part of a throttling mechanism where a queue is filled up in batches, or if data needs to be loaded from a server in pages.

Parameters

  • count — The number of pending tasks until which to wait before resolving the returned promise

Return value

A promise that’s resolved when the number of pending tasks is equal to or lower than the specified count (or zero), or rejected when the queue is stopped.

Related