Class Pot.Deferred#repeat
Defined in: <pot.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
Pot.Deferred#repeat((max), callback, (context))
"repeat" loop iterates a specified number.
|
Field Attributes | Field Name and Description |
---|---|
Iterates "repeat" loop with slower speed.
|
|
Iterates "repeat" loop with fast speed.
|
|
Iterates "repeat" loop with slowest speed.
|
|
Iterates "repeat" loop with fastest speed.
|
|
Iterates "repeat" loop with default speed.
|
|
Iterates "repeat" loop with faster speed.
|
|
Iterates "repeat" loop with slow speed.
|
Class Detail
Pot.Deferred#repeat((max), callback, (context))
"repeat" loop iterates a specified number. (Asynchronous)
If you specify the first argument as a function
then the results of the previous chain will be used.
var d = new Pot.Deferred(); var p = document.getElementsByTagName('p'); d.repeat(p.length, function(i, last) { p[i].innerHTML += last ? 'end' : i; }).then(function() { debug('finish'); }).begin();
- Parameters:
- {Number|Object} (max)
- The maximum number of times to loop, or object.
- {Function} callback
- An iterable function. Throw Pot.StopIteration if you want to stop the loop.
- {*} (context)
- Optionally, context object. (i.e. this)
- Returns:
- {Deferred} Return the Deferred.
Field Detail
{Function}
doze
Iterates "repeat" loop with slower speed.
{Function}
fast
Iterates "repeat" loop with fast speed.
{Function}
limp
Iterates "repeat" loop with slowest speed.
{Function}
ninja
Iterates "repeat" loop with fastest speed.
{Function}
normal
Iterates "repeat" loop with default speed.
{Function}
rapid
Iterates "repeat" loop with faster speed.
{Function}
slow
Iterates "repeat" loop with slow speed.