Class Pot.Deferred#items
Defined in: <pot.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
Pot.Deferred#items((callback), (context))
Collect the object key and value and make array as items format.
|
Field Attributes | Field Name and Description |
---|---|
Iterates "items" loop with slower speed.
|
|
Iterates "items" loop with fast speed.
|
|
Iterates "items" loop with slowest speed.
|
|
Iterates "items" loop with fastest speed.
|
|
Iterates "items" loop with default speed.
|
|
Iterates "items" loop with faster speed.
|
|
Iterates "items" loop with slow speed.
|
Class Detail
Pot.Deferred#items((callback), (context))
Collect the object key and value and make array as items format.
var obj = {foo: 1, bar: 2, baz: 3}; var d = new Deferred(); d.items().then(function(res) { debug(res); // @results [['foo', 1], ['bar', 2], ['baz', 3]] }).begin(obj);
var array = ['foo', 'bar', 'baz']; var d = new Deferred(); d.items().then(function(res) { debug(res); // @results [[0, 'foo'], [1, 'bar'], [2, 'baz']] }).begin(array);
// Example for using callback. var arr = ['foo', 'bar', 'baz']; var func = function(item) { return '(' + item[0] + ')' + item[1]; }; var d = new Deferred(); d.items(func).then(function(res) { debug(res); // @results ['(0)foo', '(1)bar', '(2)baz'] }).begin(arr);
// Example for using callback. var obj = {foo: 1, bar: 2, baz: 3}; var func = function(item) { return [item[0] + '::' + item[1]]; }; var d = new Deferred(); d.items(func).then(function(res) { debug(res); // @results [['foo::1'], ['bar::2'], ['baz::3']] }).begin(obj);
- Parameters:
- {Function} (callback)
- (Optional) Callback function. function({Array} item[, object]) this == `context`.
- {*} (context)
- (Optional) Object to use as `this` when executing callback.
- Returns:
- {Array} The collected items as an array.
Field Detail
{Function}
doze
Iterates "items" loop with slower speed.
{Function}
fast
Iterates "items" loop with fast speed.
{Function}
limp
Iterates "items" loop with slowest speed.
{Function}
ninja
Iterates "items" loop with fastest speed.
{Function}
normal
Iterates "items" loop with default speed.
{Function}
rapid
Iterates "items" loop with faster speed.
{Function}
slow
Iterates "items" loop with slow speed.