Options
Menu

Class HistoricalElement<T>

This represents a particular node in a HistoricalModel's contents. If you think of the contents of a model as a JSON tree, this could be the root object, an array, or any other element.

Much of the API of this class is designed to be the same as a RealTimeModel, since the logic that deals with each representation is likely to be shared.

As HistoricalElements represent a snapshot of a RealTimeElement in a given moment in time, they are read-only.

Type parameters

  • T

Hierarchy

Implements

Index

Properties

Events

Events: HistoricalElementEvents = ObservableElementEventConstants

An interface enumerating the different events that could be fired on this HistoricalElement.

Methods

addListener

events

  • Provides the events emitted by this object as an Observable stream.

    example
    
    eventEmitter.events()
      .filter(e => e.name === "myevent")
      .subscribe(e => console.log(e));
    

    Returns Observable<IConvergenceEvent>

    An Observable stream of all events emitted by this object.

id

  • id(): string

isAttached

  • isAttached(): boolean

isDetached

  • isDetached(): boolean

model

off

on

once

parent

path

relativePath

  • 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
    

    Returns PathElement

    a PathElement representing this node's location relative to its parent, or null if it has no parent.

removeAllListeners

removeListener

removeListeners

toJSON

  • toJSON(): any

type

  • type(): string
  • This element's type. See [[ModelElementType]] for an enumeration of types.

    Returns string

value

  • value(): T
  • The value of this element at the parent model's current version.

    Returns T