AsyncQueue
No description provided
AsyncQueue
new AsyncQueue();Properties
public entries: any
The queued entries
public exceptionHandler: any
public size: any
The total number of entries in this queue. Returns 0 if no entries are available.
Methods
public acquire(options?): AsyncQueueEntry
Acquire an entry.
// lock the queue
const entry = asyncQueue.acquire();
// wait until previous task is completed
await entry.getTask();
// do something expensive
await performSomethingExpensive();
// make sure to release the lock once done
asyncQueue.release();| Parameter | Type | Optional |
|---|---|---|
| options | AsyncQueueAcquisitionOptions | ✅ |
public cancelAll(): void
Cancel all entries
public clear(consume): void
Clear entries queue
| Parameter | Type | Optional | Description |
|---|---|---|---|
| consume | boolean | ❌ | Whether or not to consume all entries before clearing |
public release(): void
Release the current acquisition and move to next entry.
public removeEntry(entry): boolean
Remove the given entry from the queue
| Parameter | Type | Optional | Description |
|---|---|---|---|
| entry | AsyncQueueEntry | ❌ | The entry to remove |