Type alias StartStopNotifier<T>

StartStopNotifier<T>: ((set, update) => 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) => void)

        Function that sets the value of the store.

          • (value): void
          • Parameters

            • value: T

            Returns void

      • update: ((fn) => 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)

Returns

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