new Collection
A mutable MVC Array.
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
array |
Array |
<optional> |
(Optional) Array. |
- Source:
- collection.js, line 70
Extends
Methods
-
bindTo
-
Binds a View to a Model.
Parameters:
Name Type Argument Description keystring Key.
targetol.Object Target.
targetKeystring <optional>
(Optional) Target key.
noNotifyboolean <optional>
(Optional) No notify.
- Inherited From:
- Source:
- object.js, line 147
-
clear
-
Remove all elements from the collection.
- Source:
- collection.js, line 89
-
extend
-
Parameters:
Name Type Description arrArray Array.
- Source:
- collection.js, line 100
Returns:
This collection.
- Type
- ol.Collection
-
forEach
-
Iterate over each element, calling the provided callback.
Parameters:
Name Type Argument Description fFunction The function to call for every element. This function takes 3 arguments (the element, the index and the array). The return value is ignored.
objObject <optional>
(Optional) The object to be used as the value of 'this' within f.
- Source:
- collection.js, line 117
-
get
-
Gets a value.
Parameters:
Name Type Description keystring Key.
- Inherited From:
- Source:
- object.js, line 170
Returns:
Value.
- Type
- *
-
getArray
-
Get a reference to the underlying Array object. Warning: if the array is mutated, no events will be dispatched by the collection, and the collection's "length" property won't be in sync with the actual length of the array.
- Source:
- collection.js, line 129
Returns:
Array.
- Type
- Array
-
getAt
-
Get the element at the provided index.
Parameters:
Name Type Description indexnumber Index.
- Source:
- collection.js, line 139
Returns:
Element.
- Type
- *
-
getLength
-
Get the length of this collection.
- Source:
- collection.js, line 148
Returns:
Length.
- Type
- number
-
insertAt
-
Insert an element at the provided index.
Parameters:
Name Type Description indexnumber Index.
elem* Element.
- Source:
- collection.js, line 158
-
notify
-
Notify all observers of a change on this property. This notifies both objects that are bound to the object's property as well as the object that it is bound to.
Parameters:
Name Type Description keystring Key.
- Inherited From:
- Source:
- object.js, line 208
-
on
-
Listen for a certain type of event.
Parameters:
Name Type Argument Description typestring | Array.<string> The event type or array of event types.
listenerFunction The listener function.
scopeObject <optional>
(Optional) Object is whose scope to call the listener.
- Inherited From:
- Source:
- object.js, line 240
Returns:
Unique key for the listener.
- Type
- goog.events.Key
-
once
-
Listen once for a certain type of event.
Parameters:
Name Type Argument Description typestring | Array.<string> The event type or array of event types.
listenerFunction The listener function.
scopeObject <optional>
(Optional) Object is whose scope to call the listener.
- Inherited From:
- Source:
- object.js, line 253
Returns:
Unique key for the listener.
- Type
- goog.events.Key
-
pop
-
Remove the last element of the collection.
- Source:
- collection.js, line 170
Returns:
Element.
- Type
- *
-
push
-
Insert the provided element at the end of the collection.
Parameters:
Name Type Description elem* Element.
- Source:
- collection.js, line 180
Returns:
Length.
- Type
- number
-
remove
-
Removes the first occurence of elem from the collection.
Parameters:
Name Type Description elem* Element.
- Source:
- collection.js, line 192
Returns:
The removed element or undefined if elem was not found.
- Type
- *
-
removeAt
-
Remove the element at the provided index.
Parameters:
Name Type Description indexnumber Index.
- Source:
- collection.js, line 209
Returns:
Value.
- Type
- *
-
set
-
Sets a value.
Parameters:
Name Type Description keystring Key.
value* Value.
- Inherited From:
- Source:
- object.js, line 263
-
setAt
-
Set the element at the provided index.
Parameters:
Name Type Description indexnumber Index.
elem* Element.
- Source:
- collection.js, line 224
-
setValues
-
Sets a collection of key-value pairs.
Parameters:
Name Type Description valuesObject.<string, *> Values.
- Inherited From:
- Source:
- object.js, line 286
-
un
-
Unlisten for a certain type of event.
Parameters:
Name Type Argument Description typestring | Array.<string> The event type or array of event types.
listenerFunction The listener function.
scopeObject <optional>
(Optional) Object is whose scope to call the listener.
- Inherited From:
- Source:
- object.js, line 326
-
unbind
-
Removes a binding. Unbinding will set the unbound property to the current value. The object will not be notified, as the value has not changed.
Parameters:
Name Type Description keystring Key.
- Inherited From:
- Source:
- object.js, line 305
-
unbindAll
-
Removes all bindings.
- Inherited From:
- Source:
- object.js, line 344
-
unByKey
-
Removes an event listener which was added with listen() by the key returned by on().
Parameters:
Name Type Argument Description keynumber <nullable>
Key.
- Inherited From:
- Source:
- object.js, line 336