Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HyperValue<T>

This is a main class of the library. You can create hyper-values using constructor: const a = new HyperValue(1).

After that you'll be able to read and write internal value and apply helpers from hyper-value/hs;

class

HyperValue

Type parameters

  • T

    type of internal value; it can be omitted if it's possible to infer the type from constructor

Hierarchy

  • HyperValue

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • creates a new HyperValue instance

    Parameters

    • initialValue: T

      the initial value of hyper-value, cannot be omitted

    Returns HyperValue

Properties

id

id: number = currentId++

Private newValue

newValue: T

Private updating

updating: boolean = false

Private value

value: T

Accessors

$

  • get $(): T
  • set $(newValue: T): void
  • reading and writing $ is recommended way to read and write the value of hyper-value

    Returns T

  • reading and writing $ is recommended way to read and write the value of hyper-value

    Parameters

    • newValue: T

    Returns void

Methods

g

  • g(silent?: undefined | true | false): T
  • reads the value of hyper-value

    Parameters

    • Optional silent: undefined | true | false

      if set to true it will not trigger recording as dependency; it could be used inside auto helper function and similar ones

    Returns T

s

  • s(newValue: T): void
  • sets new value of hyper-value (if the value is the same according to === nothing will happen)

    Parameters

    • newValue: T

      the new value

    Returns void

Generated using TypeDoc