Skip to content

Latest commit

 

History

History
170 lines (88 loc) · 2.82 KB

MVCArray.md

File metadata and controls

170 lines (88 loc) · 2.82 KB

See html formatted version

MVCArray class

google.maps.MVCArray class

This class extends MVCObject.

Constructor

undefined

MVCArray([array])

Parameters: 

  • array:  Array optional

A mutable MVC Array.

Methods

undefined

clear()

Parameters:  None

Return Value:  None

Removes all elements from the array.

undefined

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).

undefined

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.

undefined

getAt(i)

Parameters: 

  • i:  number

Return Value:  T

Returns the element at the specified index.

undefined

getLength()

Parameters:  None

Return Value:  number

Returns the number of elements in this array.

undefined

insertAt(i, elem)

Parameters: 

  • i:  number
  • elem:  T

Return Value:  None

Inserts an element at the specified index.

undefined

pop()

Parameters:  None

Return Value:  T

Removes the last element of the array and returns that element.

undefined

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.

undefined

removeAt(i)

Parameters: 

  • i:  number

Return Value:  T

Removes an element from the specified index.

undefined

setAt(i, elem)

Parameters: 

  • i:  number
  • elem:  T

Return Value:  None

Sets an element at the specified index.

Events

undefined

function(index)

Arguments: 

  • index:  number

This event is fired when insertAt() is called. The event passes the index that was passed to insertAt().

undefined

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.

undefined

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.