Class Index | File Index

Classes


Class Pot.Deferred#forEach


Defined in: <pot.js>.

Class Summary
Constructor Attributes Constructor Name and Description
 
Pot.Deferred#forEach(callback, (context))
Iterates as "for each" loop.
Field Summary
Field Attributes Field Name and Description
 
Iterates "for each" loop with slower speed.
 
Iterates "for each" loop with fast speed.
 
Iterates "for each" loop with slowest speed.
 
Iterates "for each" loop with fastest speed.
 
Iterates "for each" loop with default speed.
 
Iterates "for each" loop with faster speed.
 
Iterates "for each" loop with slow speed.
Class Detail
Pot.Deferred#forEach(callback, (context))
Iterates as "for each" loop. (Asynchronous) Iteration will use the results of the previous chain.
Unlike Deferred, speed options affect to cutback count in loop.
Options append to after the forEach and execute it.

 e.g. d.forEach.slow(function() {...}).then(function() {...})

The available methods are below.
------------------------------------
  method name   |  speed
------------------------------------
     limp       :  slowest
     doze       :  slower
     slow       :  slowly
     normal     :  normal (default)
     fast       :  fast
     rapid      :  faster
     ninja      :  fastest
------------------------------------
  var elems = document.getElementsByTagName('*');
  var defer = new Pot.Deferred();
  var alpha = 1;
  defer.forEach.slow(function(elem, i, elems) {
    alpha -= 0.02;
    if (alpha < 0.02) {
      alpha = 0.02;
    }
    elem.style.opacity = alpha;
  }).wait(5).forEach(function(elem, i, elems) {
    elem.style.opacity = 1;
  }).then(function() {
    debug('end');
  }).begin(elems);
Parameters:
{Function} callback
An iterable function. function(value, key, object) this == `context`. Throw Pot.StopIteration if you want to stop the loop.
{*} (context)
Optionally, context object. (i.e. this)
Field Detail
{Function} doze
Iterates "for each" loop with slower speed.

{Function} fast
Iterates "for each" loop with fast speed.

{Function} limp
Iterates "for each" loop with slowest speed.

{Function} ninja
Iterates "for each" loop with fastest speed.

{Function} normal
Iterates "for each" loop with default speed.

{Function} rapid
Iterates "for each" loop with faster speed.

{Function} slow
Iterates "for each" loop with slow speed.

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Sep 21 2012 19:32:22 GMT+0900 (JST)