createEventQueue
function createEventQueue<T>(callback): object;
Create a queue to handle buffering and trigger provided callback being
called in order.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | (item) => void | The callback being called |
Returns
| Name | Type | Description |
|---|---|---|
discard() | () => void | Discard all the items without any side effects |
enqueue() | (item) => void | Put an item to the end of the queue. When the attribute buffering is false, it triggers the callback immediately instead of putting the item into the queue. |
flush() | () => T[] | Empty the queue by running the callback with all the items in the queue in-order, and returns the items; |
get buffering | boolean | - |
set buffering | void | - |
get items | T[] | - |
get length | number | - |