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

Implemented by

Properties

Properties

read: (() => T)

Type declaration

    • (): T
    • Retrieve the current state.

      Returns T

watch: ((watcher) => Unwatch)

Type declaration

    • (watcher): Unwatch
    • Subscribes watcher to receive notifications.

      Parameters

      • watcher: Watcher<T>

        The subscribed function.

      Returns Unwatch

      • a callback for unsubscribing
write: ((state) => T)

Type declaration

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

      Parameters

      • state: T

      Returns T

Generated using TypeDoc