ReadOnlyObservableCollection - Andrei15193/react-model-view-viewmodel GitHub Wiki
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.
- TItem - The type of items the collection contains.
-
constructor - Initializes a new instance of the
ReadOnlyObservableCollection<TItem>class.
-
readonlycollectionChanged - An event that is raised when the collection changed by adding or removing items. -
readonlycollectionReordered - An event that is raised when the collection is reordered. - length - Gets the number of items in the collection.
-
inheritedpropertiesChanged - An event that is raised when one or more properties may have changed.
- [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
callbackfor each. - includes - Checks whether the provided item is in the collection.
-
indexOf - Returns the first index of an item, or
-1if none can be found. -
join - Aggregates the contained items into a
Stringplacing the providedseparatorbetween them. - keys - Gets an iterator that provides the indexes for each element in the collection.
-
lastIndexOf - Returns the last index of an item, or
-1if 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
startindex up to, but not including, the providedendindex. - 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.
-
protectedcopyWithin - Copies items inside the collection overwriting existing ones. -
protectedfill - Fills the collection with the provideditem. -
protectedget - Gets the item at the provided index. -
protectedpop - Removes the last element from the collection and returns it. If the collection is empty,undefinedis returned. -
protectedpush - Appends new elements to the end of the collection, and returns the new length of the collection. -
protectedreverse - Reverses the items in the collections and returns the observable collection. -
protectedset - Sets the provided item at the provided index. -
protectedshift - Removes the first element from the collection and returns it. If the collection is empty,undefinedis returned. -
protectedsort - Reverses the items in the collections and returns the observable collection. -
protectedsplice - Removes and/or adds elements to the collection and returns the deleted elements. -
protectedunshift - Inserts new elements at the start of the collection, and returns the new length of the collection.
-
ViewModel
- ReadOnlyObservableCollection<TItem>
- ReadOnlyObservableSet<TItem>
- ReadOnlyObservableMap<TKey, TItem>
- Validatable<TValidationError>