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

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<unknown>[] = []

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

Protected _watchers

_watchers: WatcherFunction<unknown>[] = []

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

value

value: unknown | undefined

Current value of the observable.

Methods

evaluate

  • evaluate(): T | undefined

observe

unobserve

unwatch

update

  • update(value: T | undefined): void
  • Method used to update the value property. This method is overridden from the base class to ensure it only runs when there is a valid data change.

    Parameters

    • value: T | undefined

      New value of the computed observable.

    Returns void

watch

Generated using TypeDoc