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.

### Hierarchy

- HistoricalModel

### Implements

- ObservableModel

## Index

### Properties

- Events

### Methods

- backward
- collectionId
- createdTime
- elementAt
- forward
- isTransitioning
- maxTime
- maxVersion
- minTime
- minVersion
- modelId
- playTo
- root
- session
- targetVersion
- time
- version

## Properties

### StaticEvents

Events: HistoricalModelEvents = HistoricalModelEventConstants

## Methods

### backward

- backward(delta?: number): Promise<void>

- "Plays" the current version of this model backward by the given number of versions.

  #### Parameters

  - ##### delta: number = 1

    the number of versions to move backward

  #### Returns Promise<void>

  A Promise, which on resolve indicates that the playback has completed.

### collectionId

- collectionId(): string

- Implementation of ObservableModel.collectionId

  The model's collection ID

  #### Returns string

### createdTime

- createdTime(): Date

- Implementation of ObservableModel.createdTime

  The timestamp at which this model was created

  #### Returns Date

### elementAt

- elementAt(path: Path): HistoricalElement<any>
- elementAt(...elements: PathElement[]): HistoricalElement<any>

- 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.

  #### Parameters

  - ##### path: Path

    the search path for querying within this model's contents

  #### Returns HistoricalElement<any>

- 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.

  #### Parameters

  - ##### Rest ...elements: PathElement[]

    an array of search path elements (which in totality are a Path)

  #### Returns HistoricalElement<any>

### forward

- forward(delta?: number): Promise<void>

- "Plays" the current version of this model forward by the given number of versions.

  #### Parameters

  - ##### delta: number = 1

    the number of versions to move forward

  #### Returns Promise<void>

  A Promise, which on resolve indicates that the playforward has completed.

### isTransitioning

- isTransitioning(): boolean

- 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

  #### Returns boolean

  true if this model is in the process of playing to a particular version

### maxTime

- maxTime(): Date

- Implementation of ObservableModel.maxTime

  The most recent timestamp at which this model was modified

  #### Returns Date

### maxVersion

- maxVersion(): number

- Implementation of ObservableModel.maxVersion

  The most recent version of this model. Equivalent to RealTimeModel.version

  #### Returns number

### minTime

- minTime(): Date

- Implementation of ObservableModel.minTime

  The oldest timestamp associated with this model. This is just an alias for createdTime

  #### Returns Date

### minVersion

- minVersion(): number

- Implementation of ObservableModel.minVersion

  The oldest version of this model. Versions are 0-based, so this will just return `0`.

  #### Returns number

### modelId

- modelId(): string

- Implementation of ObservableModel.modelId

  The model's unique ID

  #### Returns string

### playTo

- playTo(version: number): Promise<void>

- 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.

  #### Parameters

  - ##### version: number

    the version of the model at which point in time you're interested

  #### Returns Promise<void>

### root

- root(): HistoricalObject

- Implementation of ObservableModel.root

  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

  #### Returns HistoricalObject

  the entire contents of this model at the current version as a HistoricalObject

### session

- session(): ConvergenceSession

- Implementation of ObservableModel.session

  The session attached to the currently-active domain.

  #### Returns ConvergenceSession

### targetVersion

- targetVersion(): number

- 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

  #### Returns number

### time

- time(): Date

- Implementation of ObservableModel.time

  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"
        })

  #### Returns Date

  the timestamp associated with this model's current version

### version

- version(): number

- Implementation of ObservableModel.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
        })

  #### Returns number