API > wxt/utils/storage > WxtStorageItem
Interface: WxtStorageItem<TValue, TMetadata>
Contents
Type parameters
▪ TValue
▪ TMetadata extends Record<string, unknown>
Properties
defaultValue
defaultValue:
TValue
Deprecated
Renamed to fallback, use it instead.
Source
packages/storage/dist/index.d.mts:156
fallback
fallback:
TValue
The value provided by the fallback option.
Source
packages/storage/dist/index.d.mts:158
key
key: `local:${string}` | `session:${string}` | `sync:${string}` | `managed:${string}`
The storage key passed when creating the storage item.
Source
packages/storage/dist/index.d.mts:154
Methods
getMeta()
getMeta():
Promise<NullablePartial<TMetadata>>
Get metadata.
Source
packages/storage/dist/index.d.mts:162
getValue()
getValue():
Promise<TValue>
Get the latest value from storage.
Source
packages/storage/dist/index.d.mts:160
migrate()
migrate():
Promise<void>
If there are migrations defined on the storage item, migrate to the latest version.
This function is ran automatically whenever the extension updates, so you don't have to call it manually.
Source
packages/storage/dist/index.d.mts:182
removeMeta()
removeMeta(
properties?):Promise<void>
Remove all metadata or certain properties from metadata.
Parameters
▪ properties?: string[]
Source
packages/storage/dist/index.d.mts:170
removeValue()
removeValue(
opts?):Promise<void>
Remove the value from storage.
Parameters
▪ opts?: RemoveItemOptions
Source
packages/storage/dist/index.d.mts:168
setMeta()
setMeta(
properties):Promise<void>
Set metadata properties.
Parameters
▪ properties: NullablePartial<TMetadata>
Source
packages/storage/dist/index.d.mts:166
setValue()
setValue(
value):Promise<void>
Set the value in storage.
Parameters
▪ value: TValue
Source
packages/storage/dist/index.d.mts:164
watch()
watch(
cb):Unwatch
Listen for changes to the value in storage.
Parameters
▪ cb: WatchCallback<TValue>
Source
packages/storage/dist/index.d.mts:172
watchMeta()
watchMeta(
cb):Unwatch
Listen for changes to metadata in storage.
Parameters
▪ cb: WatchCallback<NullablePartial<TMetadata>>
Source
packages/storage/dist/index.d.mts:174
Generated using typedoc-plugin-markdown and TypeDoc