A Listener class that manages event listeners for state changes.

Type Parameters

  • T = unknown

    The type of the value being listened to. Defaults to unknown.

Hierarchy (view full)

Constructors

Properties

onError?: onError

The error handling function to call when an error occurs.

The start function called when all listeners are started.

The stop function called when all listeners are stopped.

Methods

  • Registers a callback to be called when the state changes. If a callback was previously registered, it will be replaced with the new one.

    Parameters

    • callback: ((value: T) => Promise<void>)

      The function to call with the new state value.

        • (value): Promise<void>
        • Parameters

          • value: T

          Returns Promise<void>

    Returns void