Options
Menu

Class LocalModelReference<V, R>

The parent class for a local reference.

Type parameters

Hierarchy

Index

Properties

StaticEvents

Events: ModelReferenceEvents = ModelReference.Events

A mapping of the events this model reference could emit to each event's unique name. Use this to refer an event name:

localReference.on(LocalModelReference.Events.SET, function listener(e) {
  // ...
})

Methods

addListener

clear

  • clear(): void
  • Clears any values on this reference. This is a way to explictly indicate that the reference currently has no value.

    Returns void

dispose

  • dispose(): void
  • Disposes the reference, unpublishing it beforehand if necessary.

    Returns void

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.

isDisposed

  • isDisposed(): boolean
  • Returns true if this reference has already been disposed (cleaned up).

    Returns boolean

isLocal

  • isLocal(): boolean
  • Returns true.

    Returns boolean

isSet

  • isSet(): boolean
  • Returns true if a value is currenly set on the reference.

    Returns boolean

isShared

  • isShared(): boolean
  • Returns true if this reference is currently being shared.

    Returns boolean

key

  • key(): string
  • Returns the unique key corresponding to this reference.

    Returns string

off

on

once

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

    Parameters

    Returns ConvergenceEventEmitter<IConvergenceEvent>

    This object, in support of a fluent API.

reference

  • reference(): R

removeAllListeners

removeListener

removeListeners

sessionId

  • sessionId(): string
  • Returns the session ID of the user session that created this reference.

    Returns string

set

  • set(value: V): void
  • set(value: V[]): void
  • Sets one or multiple values on this reference. If the reference is published, it will emit an event do any remote listeners.

    Parameters

    • value: V

      the new value(s)

    Returns void

  • Parameters

    • value: V[]

    Returns void

share

  • share(): void
  • Publishes the reference, such that other users with access to the attached model can access this reference and its underlying value(s). If the reference is already shared, the call will simply be ignored.

    Returns void

source

type

  • Returns a string indicating the type of reference this is.

    Returns ReferenceType

unshare

  • unshare(): void
  • Unpublishes the reference, essentially making it private. If the reference is not currently shared, the call will simply be ignored.

    Returns void

user

  • Returns the user that created this reference.

    Returns DomainUser

value

  • value(): V
  • Returns the first value of the underlying reference.

    Returns V

values

  • values(): V[]
  • Returns all values of the underlying reference.

    Returns V[]