Class Index | File Index

Classes


Class eniro.maps.MapArray


Defined in: MapArray.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
A mutable array where the array operations trigger events.
Method Summary
Method Attributes Method Name and Description
 
Removes all elements from this array.
 
forEach(callback)
Iterate over all elements.
 
Returns the underlying array.
 
getAt(i)
Returns the element at index i.
 
Returns the length of the array.
 
insertAt(i, elem)
Inserts the element at the given index.
 
pop()
Removes the last element of the array and returns that.
 
push(elem)
Adds new elements to the end of this array.
 
Removes the element at the given index, shifts the elements and returns the removed object.
 
setAt(i, elem)
Set the element at index i to the given argument.
Event Summary
Event Attributes Event Name and Description
 
insert_at(index, elem)
Element inserted in array shifting elements.
 
remove_at(index, elem)
Element removed from array.
 
set_at(index, elem)
Element value at position set.
Class Detail
eniro.maps.MapArray(array)
A mutable array where the array operations trigger events.
Parameters:
{Array} array Optional
optional array to build from.
Method Detail
clear()
Removes all elements from this array.

forEach(callback)
Iterate over all elements.
Parameters:
{Function} callback
a callback that will receive (element, index) for each element in this array.

{Array} getArray()
Returns the underlying array. Changes to this will not be discovered.
Returns:
{Array} the array

{Object} getAt(i)
Returns the element at index i.
Parameters:
{number} i
the index.
Returns:
{Object} the element.

{number} getLength()
Returns the length of the array.
Returns:
{number} the length.

insertAt(i, elem)
Inserts the element at the given index.
Parameters:
{number} i
the index to insert at
{Object} elem
the element to insert.

{Object} pop()
Removes the last element of the array and returns that.
Returns:
{Object} the last element of the array or undefined if array is empty.

push(elem)
Adds new elements to the end of this array. Can take multiple arguments.
Parameters:
{Object} elem
the element to add.

{Object} removeAt(i)
Removes the element at the given index, shifts the elements and returns the removed object.
Parameters:
i
Returns:
{Object} the removed object

{Object} setAt(i, elem)
Set the element at index i to the given argument.
Parameters:
{number} i
the index
{Object} elem
the element to set.
Returns:
{Object} the previous value.
Event Detail
insert_at(index, elem)
Element inserted in array shifting elements.
eniro.maps.event(array, 'insert_at', listener);
Parameters:
{number} index
index of insertion.
{Object} elem
inserted element.

remove_at(index, elem)
Element removed from array.
eniro.maps.event(array, 'remove_at', listener);
Parameters:
{number} index
index of removal.
{Object} elem
removed element.

set_at(index, elem)
Element value at position set.
eniro.maps.event(array, 'set_at', listener);
Parameters:
{number} index
index of element set.
{Object} elem
element set.

Documentation generated by JsDoc Toolkit 2.3.2 on Mon Mar 30 2020 12:10:03 GMT+0200 (CEST)