Type Alias StartStopNotifier<T>

StartStopNotifier<T>: ((set: ((value: T) => void), update: ((fn: Updater<T>) => void)) => void | (() => void))

Start and stop notification callbacks. This function is called when the first subscriber subscribes.

Type Parameters

  • T

Type declaration

    • (set, update): void | (() => void)
    • Parameters

      • set: ((value: T) => void)

        Function that sets the value of the store.

          • (value): void
          • Parameters

            • value: T

            Returns void

      • update: ((fn: Updater<T>) => void)

        Function that sets the value of the store after passing the current value to the update function.

          • (fn): void
          • Parameters

            Returns void

      Returns void | (() => void)

      Optionally, a cleanup function that is called when the last remaining subscriber unsubscribes.