-
new ObservableCollection()
-
Represents a dynamic collection that provides notifications when items get added or removed.
Members
-
<readonly> EventType :string
-
The known events for the collection.
Type:
- string
-
Properties:
-
Name Type Default Description ItemAddedstring ItemAdded Triggered when an item is added to the collection.
ItemRemovedstring ItemRemoved Triggered when an item is removed from the collection.
-
Methods
-
add(item) → {PCCViewer.ObservableCollection}
-
Add an item to the collection.
Parameters:
Name Type Description item* Any object or value to add to the collection.
Returns:
The collection object.
-
forEach(iterator, thisArg) → {PCCViewer.ObservableCollection}
-
A method to iterate over all items in the collection. This method matches the spec for
Array.prototype.forEach.Parameters:
Name Type Argument Description iteratorfunction | PCCViewer.ObservableCollection~iterator The function to execute for each item in the collection.
thisArg* <optional> The Object to be used as
thisfor the iterator function.Throws:
-
If the
iteratorparameter is not a function. -
- Type
- TypeError
Returns:
The collection object.
-
-
off(eventType, handler) → {PCCViewer.ObservableCollection}
-
Unsubscribe from an event triggered on the collection.
Parameters:
Name Type Description eventTypestring The type of event being unsubscribed.
handlerfunction The function that was used to subscribe to the event.
Returns:
The collection object.
-
on(eventType, handler) → {PCCViewer.ObservableCollection}
-
Subscribe to an event triggered on the collection.
Parameters:
Name Type Description eventTypestring The type of event being subscribed.
handlerfunction The function to call when the event is triggered.
- See:
-
- PCCViewer.ViewerControl#on
- PCCViewer.ObservableCollection.EventType
Returns:
The collection object.
-
remove(item) → {PCCViewer.ObservableCollection}
-
Remove an item from the collection.
Parameters:
Name Type Description item* The item to be removed. This must be the same object that was added to the collection.
Returns:
The collection object.
-
removeAll() → {PCCViewer.ObservableCollection}
-
Removes all items from the collection.
Returns:
The collection object.
-
toArray() → {Array.<*>}
-
Generates an array of all of the items in the collection.
Returns:
An array of all items in the collection.
- Type
- Array.<*>
Type Definitions
-
iterator(item, index, array)
-
The iterator function for the PCCViewer.ObservableCollection#forEach method.
This function can also have an optional
thisargument, as defined in the PCCViewer.ObservableCollection#forEach method.Parameters:
Name Type Description item* The item from the collection.
indexNumber The index of the item from the collection.
arrayArray An array of all the items in the collection.