Class ExternalStore<TSnapshot>Abstract

Simple hookable store with manual change notifications

Type Parameters

  • TSnapshot

Hierarchy

  • EventEmitter<ExternalStoreEvents>
    • ExternalStore

Constructors

Properties

#changed: boolean = true
#snapshot: TSnapshot = ...
prefixed: string | boolean

Methods

  • Type Parameters

    • T extends "change"

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<ExternalStoreEvents>[Extract<T, "change">]

          Returns void

    • Optional context: any

    Returns this

  • Calls each of the listeners registered for a given event.

    Type Parameters

    • T extends "change"

    Parameters

    • event: T
    • Rest ...args: ArgumentMap<ExternalStoreEvents>[Extract<T, "change">]

    Returns boolean

  • Return an array listing the events for which the emitter has registered listeners.

    Returns "change"[]

  • Return the number of listeners listening to a given event.

    Parameters

    • event: "change"

    Returns number

  • Return the listeners registered for a given event.

    Type Parameters

    • T extends "change"

    Parameters

    • event: T

    Returns ((...args) => void)[]

  • Parameters

    Returns void

  • Type Parameters

    • T extends "change"

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<ExternalStoreEvents>[Extract<T, "change">]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns this

  • Add a listener for a given event.

    Type Parameters

    • T extends "change"

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<ExternalStoreEvents>[Extract<T, "change">]

          Returns void

    • Optional context: any

    Returns this

  • Add a one-time listener for a given event.

    Type Parameters

    • T extends "change"

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<ExternalStoreEvents>[Extract<T, "change">]

          Returns void

    • Optional context: any

    Returns this

  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: "change"

    Returns this

  • Remove the listeners of a given event.

    Type Parameters

    • T extends "change"

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<ExternalStoreEvents>[Extract<T, "change">]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns this

  • Parameters

    • Optional p: any

    Returns TSnapshot

  • Parameters

    • Optional p: any

    Returns TSnapshot

Generated using TypeDoc