Options
Menu

Class RealTimeNull

This is a convenience object that wraps a javascript null. These are returned when a RealTimeObject or RealTimeArray contains a null value. The value() of this is always null and cannot be changed.

See RealTimeNullEvents for the events that can be emitted on remote changes to this object.

More information is in the developer guide.

Hierarchy

Implements

Index

Properties

Events

Events: RealTimeNullEvents = ObservableNullEventConstants

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
  • Each node within a RealTimeModel has a system-generated ID that is unique within this model's contents.

    Returns string

    a unique (to the model) ID for this element

isAttached

  • isAttached(): boolean

isDetached

  • isDetached(): boolean

model

off

on

once

parent

path

reference

  • Returns the remote ModelReference created by the given sessionId with the unique name key, or undefined if no such reference exists.

    See Remote References in the developer guide.

    Parameters

    • sessionId: string

      The session ID that created the reference

    • key: string

      the reference's unique key

    Returns ModelReference

references

  • Returns any remote references that match the given filter. You can provide a single key which could return references from multiple users, sessionId which would return all of a particular user session's references, or both, which is really just the same as using the reference method.

    Parameters

    • referenceFilter: ReferenceFilter

      an object containing either a sessionId, key, or both

    Returns ModelReference[]

    An array of remote ModelReferences, or an empty array if there were no matches.

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

removeFromParent

  • removeFromParent(): void
  • A convenience function to delete this element. Throws an error if this is the root object in a model.

    Returns void

removeListener

removeListeners

toJSON

  • toJSON(): any

type

  • type(): string

value

  • value(): void
  • value(value: void): void