"Plays" the current version of this model backward by the given number of versions.
the number of versions to move backward
A Promise, which on resolve indicates that the playback has completed.
The model's collection ID
The timestamp at which this model was created
Given a search path, returns a read-only representation of the element at that path at the current played-to version, or null if no such element exists.
the search path for querying within this model's contents
Given an array of search path elements, returns a read-only representation of the element at that path at the current played-to version, or null if no such element exists.
an array of search path elements (which in totality are a Path)
"Plays" the current version of this model forward by the given number of versions.
the number of versions to move forward
A Promise, which on resolve indicates that the play forward has completed.
Returns true when the model is in the process of playing to a particular version:
historicalModel.version() // 433
historicalModel.isTransitioning() // false
historicalModel.playTo(1)
.then(() => {
historicalModel.version() // 1
historicalModel.isTransitioning() // false
})
historicalModel.isTransitioning() // true
true if this model is in the process of playing to a particular version
The most recent timestamp at which this model was modified
The most recent version of this model. Equivalent to RealTimeModel.version
The oldest timestamp associated with this model. This is just an alias for createdTime
The oldest version of this model. Versions are 0-based, so this will just return 0
.
The model's unique ID
Enables "playing" the current model to the given version number. This is an asynchronous call because it may take some time to traverse over potentially thousands of versions of this model.
The returned promise resolves when the playback process is complete.
At this point calling version
, time
, root
and elementAt
will return the
data / metadata of this model at the desired version.
the version of the model at which point in time you're interested.
A promise that will be resolved when the model has arrived at the requested version.
Enables "playing" the current model to the given version it was at, at a specific point in time. If the time corresponds exactly to a time an operation was applied to the model, the model will be played to that version. If the time does not correspond directly to a model version then the model will be played to the version corresponding to the most recent operation before the time request. This is because that would have been the state of the model had a user opened it at that time.
This is an asynchronous call because it may take some time to traverse over potentially thousands of versions of this model.
The returned promise resolves when the playback process is complete.
At this point calling version
, time
, root
and elementAt
will return the
data / metadata of this model at the desired version.
the time to play back the model to.
A promise that will be resolved when the model has arrived at the requested time.
Returns the entire contents of this model at the current version. Calling
this while isTransitioning === true
may have an indeterminate result and should
be avoided.
See also RealTimeModel.root
the entire contents of this model at the current version as a HistoricalObject
The session attached to the currently-active domain.
This is the "desired" version of this model. During the period when the model is in the process of playing back, this returns the targeted version. Otherwise it represents the current version.
historicalModel.version() // 433
historicalModel.targetVersion() // 433
historicalModel.playTo(1)
.then(() => {
historicalModel.version() // 1
})
historicalModel.targetVersion() // 1
historicalModel.version() // 433, because `playTo` is async
The timestamp at which the current (played to) version was created. This can be used to determine the timestamp associated with a particular version of this model. For example:
historicalModel.version() // 433
historicalModel.time() // "Fri Aug 16 2019 11:49:19 GMT-0600"
historicalModel.playTo(410)
.then(() => {
historicalModel.version() // 410
historicalModel.time() // "Fri Aug 16 2019 11:44:36 GMT-0600"
return historicalModel.playTo(1);
})
.then(() => {
// this is the timestamp at which the model was created
historicalModel.time() // "Wed Aug 14 2019 13:51:01 GMT-0600"
})
the timestamp associated with this model's current version
The current version of this model. E.g.
historicalVersion.maxVersion() // 433
historicalModel.version() // 433
historicalModel.playTo(410)
.then(() => {
historicalModel.version() // 410
return historicalModel.playTo(1);
})
.then(() => {
historicalModel.version() // 1
})
This is an alternate read-only representation of a particular RealTimeModel that allows for the introspection of the model's contents at particular points in time. History can only be traversed by version ID, but the timestamp associated with a particular version is available when this model has been "played" to that version.
The backward, forward, and playTo methods are the means for "playing" the model to a particular version or version offset.
Just like in a RealTimeModel, you can use the root and elementAt methods to access the data associated with this model's "current" version. Note that these return a read-only HistoricalObject or HistoricalElement respectively.
See the developer guide for some examples and additional information.