Create a new Ticker.
A Ticker is a simple counter to measure
progress towards a goal.
For example if there are 10 tasks that must
be completed before some action is performed,
a Ticker with length 10 can be used. The tasks
can run asychronously and tick the Ticker as
they finish. After 10 ticks, the Ticker's callback
is executed.
Parameters:
length must be an Integer. (length of the ticker)
cb must be a Function. (callback)
varTicker=function(length,cb){if(length===undefined){thrownewError('Ticker requires a length');}if(!cb){log.warn('Ticker has no callback');}this.length=length;this.cb=cb;this.progress=0;log.debug('Ticker created with length',this.length);}
Progress by one. If the ticker is finished,
run the callback.
Create a new Ticker. A Ticker is a simple counter to measure progress towards a goal. For example if there are 10 tasks that must be completed before some action is performed, a Ticker with length 10 can be used. The tasks can run asychronously and tick the Ticker as they finish. After 10 ticks, the Ticker's callback is executed.
Parameters:
length must be an Integer.
(length of the ticker)
cb must be a Function.
(callback)