Type Alias PersistConstructor<T>

PersistConstructor: CellConstructor<T> & {
    key: string;
    storage: Storage;
    deserialize(value: string): null | T;
    serialize(value: T): string;
}

Type Parameters

  • T

Type declaration

  • key: string

    The key to use in the storage

  • storage: Storage

    The web storage to use

  • deserialize?:function
    • Deserialize the value from the storage

      By default, it will use JSON.parse wrapped with try-catch

      Parameters

      • value: string

      Returns null | T

  • serialize?:function
    • Serialize the value to store in the storage

      By default, it will use JSON.stringify

      Parameters

      • value: T

      Returns string