Package Exports
- operation-queue
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (operation-queue) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
operation-queue
Queue asynchronous operations for serial execution with optional completion callbacks. At any point the queue can be cancelled. When cancelled, the queue will a) wait for any pending operation to complete and b) fire the callbacks of all other pending jobs, indicating that they were cancelled. Any new operation added to a cancelled queue will also receive an asynchronous callback indicating that it was cancelled.
API
var OperationQueue = require('operation-queue');
var queue = new OperationQueue()
Create a new operation queue.
queue.push(fn, [cb])
Enqueue operation fn
, optionally calling cb
on completion. fn
will receive a single callback as an argument that you must call to indicate that the opearation is complete; any arguments will be forwarded to your own callback.
queue.close([cb])
Close the queue, optionally calling cb
when the close operation is complete, by first waiting for any in-progress operation to complete. Any further remaining items in the queue will have their callbacks invoked with the value OperaionQueue.CANCELLED
.
License
ISC