Skip to main content

queryStorage

Callable

  • queryStorage<T>(encoder: Encoder<T>): { getItem: (key: string, initialValue: T) => T; removeItem: (key: string) => void; setItem: (key: string, value: T) => void; subscribe: (key: string, callback: (input: T) => void) => () => void }

  • Type parameters

    • T = unknown

    Parameters

    • encoder: Encoder<T>

    Returns { getItem: (key: string, initialValue: T) => T; removeItem: (key: string) => void; setItem: (key: string, value: T) => void; subscribe: (key: string, callback: (input: T) => void) => () => void }

    • getItem: (key: string, initialValue: T) => T
        • (key: string, initialValue: T): T
        • Parameters

          • key: string
          • initialValue: T

          Returns T

    • removeItem: (key: string) => void
        • (key: string): void
        • Parameters

          • key: string

          Returns void

    • setItem: (key: string, value: T) => void
        • (key: string, value: T): void
        • Parameters

          • key: string
          • value: T

          Returns void

    • subscribe: (key: string, callback: (input: T) => void) => () => void
        • (key: string, callback: (input: T) => void): () => void
        • Parameters

          • key: string
          • callback: (input: T) => void

            Returns () => void

              • (): void
              • Returns void