Options
All
  • Public
  • Public/Protected
  • All
Menu

The intention of a computed function is to use it to evaluate Observable.value instead of setting it directly.

Similarly to Observables a ComputedObservable can also be watched and observed.

Type parameters

Hierarchy

Implements

Index

Constructors

constructor

Properties

Private _computedFunction

_computedFunction: ComputedFunction<T>

Function that should be used to evaluate this object's Observable.value.

Protected _observers

_observers: ComputedObservable<any>[] = []

List of ComputedObservables that need to be updated when value changes.

Protected _watchers

_watchers: WatcherFunction<any>[] = []

List of WatcherFunctions that get run when the observable value changes.

Accessors

value

  • get value(): any

Methods

Protected _invokeWatchers

  • _invokeWatchers(value: any | undefined, oldValue: any | undefined): void
  • Safely invoke the watchers registered on this observable.

    Parameters

    • value: any | undefined

      New value of the observer.

    • oldValue: any | undefined

      Old value of the observer.

    Returns void

Protected _updateObservers

  • _updateObservers(): void

evaluate

  • evaluate(): T | undefined

observe

unobserve

unwatch

update

  • update(value: any): void

watch

Generated using TypeDoc