Skip to content

Interface: StorageStateOptions ​

Defined in: storage/define-storage-state.ts:24

The options of defineStorageState and useStorage. The defaults of storage and mode, and the prefix in front of key, come from the storage options of the instance.

Properties ​

PropertyTypeDefault valueDescriptionDefined in
clearOnDefault?booleantrueRemoves the entry instead of writing a value equal to the parser default.storage/define-storage-state.ts:39
keystringundefinedThe entry to read and write, without the prefix.storage/define-storage-state.ts:26
missing?unknownthe missing of the instanceWhat the state reads without a value or a default, and what removes the entry when written. A key set to undefined means undefined, and a key left out takes the one of the instance.storage/define-storage-state.ts:37
mode?StateMode'optimistic'With 'optimistic', the state reads back what was written even when the browser refused to store it, until the entry changes to something else. With 'source', every read goes to the storage.storage/define-storage-state.ts:47
parser?ParserInputparseAsStringTurns the stored string into a value and determines the type of the ref.storage/define-storage-state.ts:30
storage?StorageSourcethe default storage of the instance, 'local' unless configuredWhere the value lives.storage/define-storage-state.ts:28

Released under the MIT License.