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 | Description | 
|---|---|---|
| ItemAdded | string | Triggered when an item is added to the collection. | 
| ItemRemoved | string | 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, thisArgopt) → {PCCViewer.ObservableCollection}
A method to iterate over all items in the collection. This method matches the spec for Array.prototype.forEach.
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| iterator | function | PCCViewer.ObservableCollection~iterator | The function to execute for each item in the collection. | |
| thisArg | * | <optional> | The Object to be used as  | 
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 | 
|---|---|---|
| eventType | string | The type of event being unsubscribed. | 
| handler | function | 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 | 
|---|---|---|
| eventType | string | The type of event being subscribed. | 
| handler | function | 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 this argument, as defined in the PCCViewer.ObservableCollection#forEach method.
Parameters:
| Name | Type | Description | 
|---|---|---|
| item | * | The item from the collection. | 
| index | Number | The index of the item from the collection. | 
| array | Array | An array of all the items in the collection. | 
