x4js - v2.2.49
    Preparing search index...

    Class StateManager<T>

    Type Parameters

    Hierarchy (View Summary)

    Index
    • Registers an event listener for a specific event name.

      Type Parameters

      • K extends "change"

      Parameters

      • name: K

        The name of the event to listen for (must be a key in E).

      • callback: (ev: StateEvents[K]) => void

        The function to be called when the event is fired.

      • capturing: boolean = false

        If true, the listener will be added to the beginning of the listener list (capturing phase).

      Returns () => void

    • Dispatches an event with a given name and payload to all registered listeners.

      Type Parameters

      • K extends "change"

      Parameters

      • name: K

        The name of the event to fire (must be a key in E).

      • evx: StateEvents[K]

        The event payload (event object) to pass to the listeners.

      Returns void

    • Type Parameters

      • K extends "change"

      Parameters

      Returns { off: () => void }

    • Type Parameters

      • K extends "change"

      Parameters

      Returns { off: () => void }

    • Removes a previously registered event listener.

      Type Parameters

      • K extends "change"

      Parameters

      • name: K

        The name of the event from which to remove the listener.

      • callback: (ev: StateEvents[K]) => any

        The specific callback function to remove. It must be the same function instance that was originally registered.

      Returns void

    • observe changes on a specific path and everything below it. fires for the path itself and for any descendant: watch( "user", cb ) → fires on user, user.name, user.tags[0], ... returns a handle with off() to unsubscribe.

      Parameters

      Returns { off: () => void }