Abstract
Abstract
[iterator]This is the same method as the values method.
Its presence makes collections iterable, thus able to be used with ES6
for-of
loops,
...
spread operators, and more.
Symbol.iterator and the iterable protocol
for (let object of collection) {
// do something with each object
}
0.11.0
An iterable of each value in the collection.
Add a listener callback
which will be called when a live collection instance changes.
deletions and
oldModificationsreport the indices in the collection before the change happened, while
insertionsand
newModificationsreport the indices into the new version of the collection. @throws A {@link TypeAssertionError} if
callback is not a function. @example wines.addListener((collection, changes) => { // collection === wines console.log(
${changes.insertions.length} insertions); console.log(
${changes.oldModifications.length} oldModifications); console.log(
${changes.newModifications.length} newModifications); console.log(
${changes.deletions.length} deletions); console.log(
new size of collection: ${collection.length}); }); @note Adding the listener is an asynchronous operation, so the callback is invoked the first time to notify the caller when the listener has been added. Thus, when the callback is invoked the first time it will contain empty arrays for each property in the
changes` object.
A function to be called when changes occur.
Abstract
entriesAbstract
isAbstract
keysRemove the listener callback
from the collection instance.
a TypeAssertionError If callback
is not a function.
Callback function that was previously added as a listener through the addListener method.
Abstract
valuesGenerated using TypeDoc
Abstract base class containing methods shared by Realm List, Dictionary and Results.
A Collection always reflect the current state of the Realm. The one exception to this is when using
for...in
orfor...of
enumeration, which will always enumerate over the objects which matched the query when the enumeration is begun, even if some of them are deleted or modified to be excluded by the filter during the enumeration.Since
0.11.0