PromiseQueue
Summary
PromiseQueue Queues and executes asynchronous functions in sequential order.
Functions added to the queue must return an Promise object. Each function will only be executed after the previous function's promise has resolved.
Example: function asyncMethod(endpoint) { var promise = new Promise(); jsonp.get(endpoint).done(promise.resolve, promise); return promise; }
var pq = new PromiseQueue(); pq.queue(asyncMethod('firstEndpoint')); pq.queue(asyncMethod('secondEndpoint')); // will not call method until first method resolves
pq.dequeue(); // starts running the queue
Constructor
aeris.util.aeris.PromiseQueue
Syntax
aeris.util.aeris.PromiseQueue
()
Summary
Item Index
Properties
Methods
clearResolutionArgs_
Syntax
clearResolutionArgs_
()
private
Summary
dequeue
Syntax
Summary
Begin executing the queue.
Parameters:
Returns:
Promise to complete execution of the queue including all component promises.
queue
Syntax
queue
-
fn
-
opt_ctx
Summary
Add a function to the queue
stop
Syntax
stop
()
Summary
Stops execution of the queue
Properties
isRunning_
Syntax
Summary
Whether or not the queue should continue executing functions.
queueStack_
Syntax
queueStack_
Array.Summary
A set of functions to execute. In the format: [ [fnToExecute, context, promiseToResolveFn], ... ]
resolutionArgs_
Syntax
Summary
Arguments with which queue promises have been resolved/rejected.