Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface WatchableState<T>

A Watchable encapsulating a changing value which you can write and read.

Type parameters

  • T

    The value stored, retrieved and watched.

Hierarchy

Index

Properties

Properties

read

read: () => T

Type declaration

    • (): T
    • Retrieve the current state.

      Returns T

watch

watch: (watcher: Watcher<T>) => Unwatch

Type declaration

    • Subscribes watcher to receive notifications.

      Parameters

      • watcher: Watcher<T>

        The subscribed function.

      Returns Unwatch

      • a callback for unsubscribing

write

write: (state: T) => T

Type declaration

    • (state: T): T
    • Store a new state.

      Parameters

      • state: T

      Returns T

Generated using TypeDoc