Function localStorageWrapper

  • Builds a storage wrapper for storages using the same API as localStorage.

    Type Parameters

    • Outer

    Parameters

    • key: string

      Key used to store the persisted state.

    • storage: StringStorage

      The storage object (implementing localStorage API).

    • toInner: ToInner<Outer, string> = ...

      Custom conversion from state object to string (default is JSON.stringify).

    • toOuter: ToOuter<Outer, string> = ...

      Custom conversion from string to state object (default is JSON.parse).

    Returns GenericStorageWrapper<Outer, string>

    Outer - The Vuex state type.