Add documentation for new methods
This commit is contained in:
parent
f2273c6bd5
commit
862764410a
|
@ -259,6 +259,39 @@ class Collection {
|
|||
* @since 0.11.0
|
||||
*/
|
||||
reduceRight(callback, initialValue) {}
|
||||
|
||||
/**
|
||||
* Add a listener `callback` which will be called when a **live** collection instance changes.
|
||||
* @param {function(collection, changes)} callback - A function to be called when changes occur.
|
||||
* The callback function is called with two arguments:
|
||||
* - `collection`: the collection instance that changed,
|
||||
* - `changes`: a dictionary with keys `insertions`, `modifications` and `deletions`,
|
||||
* each containing a list of indices that were inserted, updated or deleted respectively.
|
||||
* @throws {Error} If `callback` is not a function.
|
||||
* @example
|
||||
* wines.addListener((collection, changes) => {
|
||||
* // collection === wines
|
||||
* console.log(`${changes.insertions.length} insertions`);
|
||||
* console.log(`${changes.modifications.length} modifications`);
|
||||
* console.log(`${changes.deletions.length} deletions`);
|
||||
* console.log(`new size of collection: ${collection.length}`);
|
||||
* });
|
||||
*/
|
||||
addListener(callback) {}
|
||||
|
||||
/**
|
||||
* Remove the listener `callback` from the collection instance.
|
||||
* @param {function(collection, changes)} callback - Callback function that was previously
|
||||
* added as a listener through the {@link Collection#addListener addListener} method.
|
||||
* @throws {Error} If `callback` is not a function.
|
||||
*/
|
||||
removeListener(callback) {}
|
||||
|
||||
/**
|
||||
* Remove all `callback` listeners from the collection instance.
|
||||
*/
|
||||
removeAllListeners(name) {}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,9 @@
|
|||
* Instances of this class are typically **live** collections returned by
|
||||
* {@link Realm#objects objects()} that will update as new objects are either
|
||||
* added to or deleted from the Realm that match the underlying query. Results returned by
|
||||
* {@link Realm.Results#snapshot snapshot()}, however, are will **not** live update.
|
||||
* {@link Realm.Results#snapshot snapshot()}, however, will **not** live update
|
||||
* (and listener callbacks added through {@link Realm.Results#addListener addListener()}
|
||||
* will thus never be called).
|
||||
* @extends Realm.Collection
|
||||
* @memberof Realm
|
||||
*/
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit c3e4be6d6cd0bf3e010e169b9793087e60eb52bb
|
||||
Subproject commit 1c2f3a7607467ed904a81a4824d0cbda33cc0ebb
|
Loading…
Reference in New Issue