useStorage API
API reference for the useStorage composable.
(options?: StorageOptions) => ECreates a new storage instance.
(_options?: StorageContextOptions) => ContextTrinity<E>(_options?: StoragePluginOptions) => anyCreates a new storage plugin.
(namespace?: string) => EReturns the current storage instance.
StorageAdapterThe storage adapter to use. Defaults to localStorage in browser, MemoryAdapter otherwise
stringThe prefix to use for all storage keys. Defaults to 'v0:'
{ read: (value: string) => unknown; write: (value: unknown) => string; }Custom serializer for reading and writing values. Defaults to JSON.parse/stringify
(key: string) => booleanCheck if a key exists in storage
<T>(key: string, defaultValue?: T) => Ref<T>Get a reactive ref for a storage key
<T>(key: string, value: T) => voidSet a value for a storage key
(key: string) => voidRemove a key from storage
() => voidClear all keys from storage