Skip to content

Latest commit

 

History

History
149 lines (148 loc) · 7.36 KB

MVCArray.md

File metadata and controls

149 lines (148 loc) · 7.36 KB

MVCArray class

google.maps.MVCArray<T> class

This class extends MVCObject.

Constructor
MVCArray
MVCArray([array])
Parameters: 
  • array (optional):  Array<T>
A mutable MVC Array.
Methods
clear
clear()
Parameters:  None
Return Value:  None
Removes all elements from the array.
forEach
forEach(callback)
Parameters: 
  • callbackfunction(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
getArray()
Parameters:  None
Return Value:  Array<T>
Returns a reference to the underlying Array. Warning: if the Array is mutated, no events will be fired by this object.
getAt
getAt(i)
Parameters: 
  • inumber
Return Value:  T
Returns the element at the specified index.
getLength
getLength()
Parameters:  None
Return Value:  number
Returns the number of elements in this array.
insertAt
insertAt(i, elem)
Parameters: 
  • inumber
  • elemT
Return Value:  None
Inserts an element at the specified index.
pop
pop()
Parameters:  None
Return Value:  T
Removes the last element of the array and returns that element.
push
push(elem)
Parameters: 
  • elemT
Return Value:  number
Adds one element to the end of the array and returns the new length of the array.
removeAt
removeAt(i)
Parameters: 
  • inumber
Return Value:  T
Removes an element from the specified index.
setAt
setAt(i, elem)
Parameters: 
  • inumber
  • elemT
Return Value:  None
Sets an element at the specified index.
Events
insert_at
function(index)
Arguments: 
  • indexnumber
This event is fired when insertAt() is called. The event passes the index that was passed to insertAt().
remove_at
function(index, removed)
Arguments: 
  • indexnumber
  • removedT
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.
set_at
function(index, previous)
Arguments: 
  • indexnumber
  • previousT
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.
<script src="replace_links.js"></script>