Skip to main content

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

ParameterTypeDescription
callback(item) => voidThe callback being called

Returns

NameTypeDescription
discard()() => voidDiscard all the items without any side effects
enqueue()(item) => voidPut 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 bufferingboolean-
set bufferingvoid-
get itemsT[]-
get lengthnumber-