Methods
xAdd(…item) → {module:EventJS}
add one or more items/arrays for concat in Array.
empty Arrays and undefined items are ignored
This:
Parameters:
Name |
Type |
Attributes |
Description |
item |
AnyItem
|
<repeatable>
|
one or more of args |
- Source:
Returns:
-
Type
-
module:EventJS
Example
// standard
[].xAdd('a'); // ['a']
[].xAdd( 'a', 'b' ); // ['a','b']
[].xAdd([ 'a', 'b' ]); // ['a','b']
[].xAdd(['a'], ['b']); // ['a','b']
// empty items
[].xAdd(); // []
[].xAdd([]); // []
[].xAdd(['a'], []); // ['a']
// undefined items
[].xAdd( undefined ); // []
[].xAdd( undefined, 'b' ); // ['b']
[].xAdd([ 'a', undefined ]); // ['a']
[].xAdd(['a'], [ undefined ]); // ['a']
This:
Parameters:
- Source:
- Tutorials:
-
Returns:
-
Type
-
external:Array
Examples
['A','B'].xEach({
success: function( item, index ) {
// return; go to the next item
// throw new Break(); stop each of items
console.log('success:', index, item );
},
complete: function() {
console.log('complete');
}
});
console.log('end');
// logs:
// success: 0 A
// success: 1 B
// complete
// end
// async
['A','B'].xEach({
async: true,
success: function( item, index ) {
// return; go to the next item
// throw new Break(); stop each of items
console.log('success:', index, item );
},
complete: function() {
console.log('complete');
}
});
console.log('end');
// logs:
// end
// success: 0 A
// success: 1 B
// complete