Skip to content

ReadOnlyObservableCollection

github-actions[bot] edited this page Dec 3, 2024 · 3 revisions
API / ReadOnlyObservableCollection<TItem> class

Represents a read-only observable collection based on the Array interface. This can be used both as a wrapper and as a base class for custom observable collections.

Extends ViewModel.
Implements IReadOnlyObservableCollection<TItem>.

class ReadOnlyObservableCollection<TItem>
    extends ViewModel
    implements IReadOnlyObservableCollection<TItem>

Source reference: src/collections/observableCollections/ReadOnlyObservableCollection.ts:16.

Generic Parameters

  • TItem - The type of items the collection contains.

Constructors

Properties

  • readonly collectionChanged - An event that is raised when the collection changed by adding or removing items.
  • readonly collectionReordered - An event that is raised when the collection is reordered.
  • length - Gets the number of items in the collection.
  • inherited propertiesChanged - An event that is raised when one or more properties may have changed.

Methods

  • [iterator] - Gets an iterator that provides each element in the collection.
  • at - Gets the item at the provided index.
  • concat - Merges the current collection with the given Array and returns a new JavaScript Array.
  • entries - Gets an iterator that provides index-item pairs for each element in the collection.
  • every - Checks whether all elements in the collection satisfy a given condition.
  • filter - Creates a new JavaScript Array containing only the items the satisfy the given collection.
  • find - Returns the first item that satisfies the given condition.
  • findIndex - Returns the index of the first item that satisfies the given condition.
  • findLast - Returns the last item that satisfies the given condition.
  • findLastIndex - Returns the index of the last item that satisfies the given condition.
  • forEach - Iterates over the entire collections executing the callback for each.
  • includes - Checks whether the provided item is in the collection.
  • indexOf - Returns the first index of an item, or -1 if none can be found.
  • join - Aggregates the contained items into a String placing the provided separator between them.
  • keys - Gets an iterator that provides the indexes for each element in the collection.
  • lastIndexOf - Returns the last index of an item, or -1 if none can be found.
  • map - Creates a new JavaScript Array constructed by mapping each item in the collection.
  • reduce - Reduces the collection to a single item.
  • reduceRight - Reduces the collection to a single item iterating the collection from end to start.
  • slice - Returns a new JavaScript Array containing the elements starting at the provided start index up to, but not including, the provided end index.
  • some - Checks whether some elements in the collection satisfy a given condition.
  • toArray - Converts the observable collection to a native JavaScript Array.
  • toReversed - Returns a JavaScript Array containing the items of the collection in reverse order.
  • toSorted - Returns a JavaScript Array containing the items of the collection in ascending order.
  • toSpliced - Returns a JavaScript Array containing the spliced items of the collection.
  • values - Gets an iterator that provides each element in the collection.
  • with - Returns a JavaScript Array containing the elements from the collection and having the one at the provided index replaced with the provided value.
  • protected copyWithin - Copies items inside the collection overwriting existing ones.
  • protected fill - Fills the collection with the provided item.
  • protected get - Gets the item at the provided index.
  • protected pop - Removes the last element from the collection and returns it. If the collection is empty, undefined is returned.
  • protected push - Appends new elements to the end of the collection, and returns the new length of the collection.
  • protected reverse - Reverses the items in the collections and returns the observable collection.
  • protected set - Sets the provided item at the provided index.
  • protected shift - Removes the first element from the collection and returns it. If the collection is empty, undefined is returned.
  • protected sort - Reverses the items in the collections and returns the observable collection.
  • protected splice - Removes and/or adds elements to the collection and returns the deleted elements.
  • protected unshift - Inserts new elements at the start of the collection, and returns the new length of the collection.

Inheritance Hierarchy

See also

Clone this wiki locally