Update collection.js
This commit is contained in:
parent
1e5e59d3c0
commit
4dc4bac37e
|
@ -431,21 +431,15 @@ class Collection {
|
||||||
* and `deletions`, each containing a list of indices in the collection that were
|
* and `deletions`, each containing a list of indices in the collection that were
|
||||||
* inserted, updated or deleted respectively. `deletions` and `oldModifications` are
|
* inserted, updated or deleted respectively. `deletions` and `oldModifications` are
|
||||||
* indices into the collection before the change happened, while `insertions` and
|
* indices into the collection before the change happened, while `insertions` and
|
||||||
* `newModifications` are indices into the new version of the collection. If partial sync
|
* `newModifications` are indices into the new version of the collection.
|
||||||
* is enabled, an additional key `partial_sync` is added.
|
|
||||||
* - `changes.partial_sync`: `error` indicates if an error has occurred, `old_state` is the previous
|
|
||||||
* state, and `new_state` is the current state.
|
|
||||||
* @throws {Error} If `callback` is not a function.
|
* @throws {Error} If `callback` is not a function.
|
||||||
* @example
|
* @example
|
||||||
* wines.addListener((collection, changes) => {
|
* wines.addListener((collection, changes) => {
|
||||||
* // collection === wines
|
* // collection === wines
|
||||||
* if (changes.partial_sync.new_state == Realm.Sync.SubscriptionState.Initialized) {
|
|
||||||
* console.log('Our subset is ready');
|
|
||||||
* console.log(`${changes.insertions.length} insertions`);
|
* console.log(`${changes.insertions.length} insertions`);
|
||||||
* console.log(`${changes.modifications.length} modifications`);
|
* console.log(`${changes.modifications.length} modifications`);
|
||||||
* console.log(`${changes.deletions.length} deletions`);
|
* console.log(`${changes.deletions.length} deletions`);
|
||||||
* console.log(`new size of collection: ${collection.length}`);
|
* console.log(`new size of collection: ${collection.length}`);
|
||||||
* }
|
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
addListener(callback) {}
|
addListener(callback) {}
|
||||||
|
|
Loading…
Reference in New Issue