Prizm Content Connect
Class: ObservableCollection

Class: ObservableCollection

PCCViewer. ObservableCollection

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.

Type
PCCViewer.ObservableCollection

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 this for the iterator function.

Throws:

If the iterator parameter is not a function.

Type
TypeError
Returns:

The collection object.

Type
PCCViewer.ObservableCollection

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.

See:
Returns:

The collection object.

Type
PCCViewer.ObservableCollection

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:
Returns:

The collection object.

Type
PCCViewer.ObservableCollection

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.

Type
PCCViewer.ObservableCollection

removeAll() → {PCCViewer.ObservableCollection}

Removes all items from the collection.

Returns:

The collection object.

Type
PCCViewer.ObservableCollection

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.


 

 


©2015. Accusoft Corporation. All Rights Reserved.

Send Feedback