Realm.Sync.ChangeEvent

Change information passed when receiving sync 'change' events.

A ChangeEvent object can only be used within the callback which it is supplied to, and cannot be stored for use later. If the callback returns a promise, the ChangeEvent will remain valid until that promise is resolved (and no further notifications for that same Realm will be made until it is resolved). The Realms supplied by the change event do not need to be explicitly closed.

changes

The change indexes for all added, removed, and modified objects in the changed Realm. This object is a hashmap of object types to arrays of indexes for all changed objects:

Note that deleting an object in Realm can cause other objects in the Realm to move, which will be reported as an insertion/deletion pair. For example, if there are ten objects in a Realm and the fifth is deleted, the change indices will be {insertions: [4], deletions: [4, 9]}.

Type:
object
Example:
{
  MyObject: {
    insertions:    [indexes...],
    deletions:     [indexes...],
    modifications: [indexes...]
  },
  MyOtherObject:
    ...
}
oldRealm

The modified Realm prior to any of the changes being applied. This can be used in combination with the change indices to read the old values of any objects which were modified.

Type:
Realm
path

The virtual path of the changed Realm. This is the portion of the URL of the synced Realm after the protocol and the host name.

Type:
string
realm

The changed realm, with the changes applied.

Type:
Realm