Methods
- callback
- Type:
function
A function to be called when changes occur. The callback function is called with two arguments:
obj
: the object that changed,changes
: a dictionary with keysdeleted
, andchangedProperties
.deleted
is true if the object has been deleted.changesProperties
is an array of properties that have changed their value.
-
Error
If
callback
is not a function.
- objectType
- Type:
string
The type of the objects that link to this object's type.
- property
- Type:
string
The name of the property that references objects of this object's type.
-
Error
If the relationship is not valid.
- callback
- Type:
function
A function previously added as listener
Add a listener callback
which will be called when a live object instance changes.
Parameters:
Throws:
Example:
wine.addListener((obj, changes) => {
// obj === wine
console.log(`object is deleted: ${changes.deleted}`);
console.log(`${changes.changedProperties.length} properties have been changed:`);
changes.changedProperties.forEach(prop => {
console.log(` ${prop}`);
});
})
boolean
Checks if this object has not been deleted and is part of a valid Realm.
Returns:boolean
indicating if the object can be safely accessed.
Realm.Results
Returns all the objects that link to this object in the specified relationship.
Parameters:
Throws:
Realm.Results
the objects that link to this object.
number
Returns the total count of incoming links to this object
Returns:number
number of links to this object.
Returns a unique identifier. For synced objects, the uniqueness is only guaranteed when the object has been synchronized.
objectForObjectId
ObjectSchema
Returns the schema for the type this object belongs to.
Returns:ObjectSchema
the schema that describes this object.
Remove all listeners.
Remove the listener callback