Adds a new event listener for the specified event. The class will ignore duplicate registrations of the same listener to the same event.
The name of the event to add the listener for.
The listener callback to register.
This object, in support of a fluent API.
Given a search path, returns the HistoricalElement at that path, or null if no such element exists. Scoped to this object, so the first element in the given path should be a string (representing an existing key)
the search path for accessing a node within this object
The HistoricalElement at the given path, or null if no such element exists
Provides the events emitted by this object as an Observable stream.
An Observable stream of all events emitted by this object.
Synchronously calls the provided callback function for each key-value pair in this object at the current version.
a function to be called for each key-value pair
Returns the HistoricalElement at the given key at the current version.
Also see RealTimeObject.get.
the key whose value is desired
Returns true if the provided key existed on this object at the current version.
Each node within a RealTimeModel has a system-generated ID that is unique within this model's contents.
This doesn't have much utility in the context of a HistoricalModel and is really only provided for API compatibility with a RealTimeModel.
true
This doesn't have much utility in the context of a HistoricalModel and is really only provided for API compatibility with a RealTimeModel.
false
Returns an array of all the current version's keys
an array with all the current version's keys
Returns the model to which this element belongs.
Removes a single event listener for a specific event.
The name of the event to remove the listener for.
The listener callback to unregister.
This object, in support of a fluent API.
Adds a new event listener for the specified event. The class will ignore duplicate registrations of the same listener to the same event.
The name of the event to add the listener for.
The listener callback to register.
This object, in support of a fluent API.
Adds a single shot event listener for the specified event. The listener will be called the first time the specified event is fired after the event registration occurs, after which the registration will be removed and no further events will be passed to the listener.
The name of the event to add the listener for.
The listener callback to register.
This object, in support of a fluent API.
Returns the parent of this element within the model.
the parent of this element, or this
if this is the root element
This returns the PathElement representing this element's location relevant to its parent. For example, given a model with contents
{
obj: {
with: 1,
stuff: ['a', 'string']
}
}
let rtNumber = rtModel.elementAt(['obj', 'with']);
rtNumber.value() // 1
rtNumber.relativePath() // 'with'
let rtString = rtModel.elementAt(['obj', 'stuff', 0]);
rtString.value() // 'a'
rtString.relativePath() // 0
a PathElement representing this node's location relative to its parent, or null if it has no parent.
Removes all listeners for all events. This is useful for cleanup before disposing of this particular event emitter.
This object, in support of a fluent API.
Removes a single event listener for a specific event.
The name of the event to remove the listener for.
The listener callback to unregister.
This object, in support of a fluent API.
Removes all listeners bound on the given event.
the name of the event to remove listeners for
This object, in support of a fluent API.
Returns a JSON-compatible representation of this element.
This element's type. See [[ModelElementType]] for an enumeration of types.
The value of this element at the parent model's current version.
A read-only history-aware version of a RealTimeObject. See HistoricalElement and HistoricalModel for some common usages.