google.maps.MVCArray class
This class extends MVCObject.
Constructor
MVCArray([array])
Parameters:
- array: Array optional
A mutable MVC Array.
Methods
clear()
Parameters: None
Return Value: None
Removes all elements from the array.
forEach(callback)
Parameters:
- callback: function(T, number)
Return Value: None
Iterate over each element, calling the provided callback. The callback is called for each element like: callback(element, index).
getArray()
Parameters: None
Return Value: Array
Returns a reference to the underlying Array. Warning: if the Array is mutated, no events will be fired by this object.
getAt(i)
Parameters:
- i: number
Return Value: T
Returns the element at the specified index.
getLength()
Parameters: None
Return Value: number
Returns the number of elements in this array.
insertAt(i, elem)
Parameters:
- i: number
- elem: T
Return Value: None
Inserts an element at the specified index.
pop()
Parameters: None
Return Value: T
Removes the last element of the array and returns that element.
push(elem)
Parameters:
- elem: T
Return Value: number
Adds one element to the end of the array and returns the new length of the array.
removeAt(i)
Parameters:
- i: number
Return Value: T
Removes an element from the specified index.
setAt(i, elem)
Parameters:
- i: number
- elem: T
Return Value: None
Sets an element at the specified index.
Events
function(index)
Arguments:
- index: number
This event is fired when insertAt() is called. The event passes the index that was passed to insertAt().
function(index, removed)
Arguments:
- index: number
- removed: T
This event is fired when removeAt() is called. The event passes the index that was passed to removeAt() and the element that was removed from the array.
function(index, previous)
Arguments:
- index: number
- previous: T
This event is fired when setAt() is called. The event passes the index that was passed to setAt() and the element that was previously in the array at that index.