Class Index | File Index

Classes


Function Namespace Pot.forEach


Defined in: <pot.js>.

Function Namespace Summary
Constructor Attributes Constructor Name and Description
 
Pot.forEach(object, 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.
Function Namespace Detail
Pot.forEach(object, callback, (context))
Iterates as "for each" loop.
Unlike Deferred, speed options affect to cutback count in loop.
Options append to after the forEach and execute it.

 e.g.   Pot.forEach.slow(obj, function() {...})

The available methods are below.
------------------------------------
  method name   |  speed
------------------------------------
     limp       :  slowest
     doze       :  slower
     slow       :  slow
     normal     :  normal (default)
     fast       :  fast
     rapid      :  faster
     ninja      :  fastest
------------------------------------
  var a = 0;
  Pot.forEach([1, 2, 3], function(value) {
    a += value;
  });
  debug(a);
  // @results 6
  var a = '';
  Pot.forEach({a:'foo', b:'bar'}, function(value, key) {
    a += key + '=' + value + ',';
  });
  debug(a);
  // @results 'a=foo,b=bar,'
Parameters:
{Array|Object} object
A target object.
{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)