1.0.1 • Published 9 years ago
flush-queue v1.0.1
flush-queue
Queue a set of functions to be executed synchronously
Installing
$ npm install flush-queue
API
A FlushQueue
is a subclass of Set
. You'll manipulate the queue with Set
methods like add
, delete
, and clear
.
queue.flush()
-> undefined
Calling queue.flush
will iterate through the functions in the queue, in insertion order, calling each. If the queue is empty when flush
is called, an exception is thrown. The queue protects against recursive flush
calls, so you can do this:
queue.add(() => {
queue.flush()
})