@nkeff/cardboard-js
    Preparing search index...

    Class Observable<T>

    A class that holds a value and notifies whenever the value changes.

    Type Parameters

    • T = any

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    _lstrs: ((data: undefined | T) => void)[] = []

    Accessors

    Methods

    • Creates a new Observable whose value is derived from another Observable. The new Observable automatically updates and notifies listeners whenever the source Observable changes.

      Type Parameters

      • K

      Parameters

      • transform: (val: T) => K

      Returns any

      const value = createObservable(2);
      const isGreater = value.computed((value) => value > 5);
      // > isGreater == false;
      value.dispatch(6);
      // > isGreater == true;
    • Parameters

      • fn: (data?: T) => void

      Returns void

    • Returns a string representation of an object.

      Returns any

    • Returns the primitive value of the specified object.

      Returns T