API > wxt/utils/storage > WxtStorageItem
Interface: WxtStorageItem<TValue, TMetadata, TKey, TFallback, TVersion, TDebug, TSchema>
Contents
Type parameters
▪ TValue
▪ TMetadata extends Record<string, unknown>
▪ TKey extends StorageItemKey = StorageItemKey
▪ TFallback = null
▪ TVersion extends number = number
▪ TDebug extends boolean = false
▪ TSchema = undefined
Properties
area
readonlyarea:TKeyextends `${A}😒{string}` ?A:StorageArea
The storage area, derived at the type level from the key prefix ('local:x' → 'local'). Runtime value mirrors driver.area.
Source
packages/storage/dist/index.d.mts:537
debug
readonlydebug:TDebug
The debug flag as captured at define-time.
Source
packages/storage/dist/index.d.mts:541
defaultValue
defaultValue:
TFallback
Deprecated
Renamed to fallback, use it instead.
Source
packages/storage/dist/index.d.mts:547
fallback
fallback:
TFallback
The fallback option value, preserved as its literal type where possible (fallback: 'system' as const → typed 'system').
Source
packages/storage/dist/index.d.mts:552
key
key:
TKey
The storage key passed to defineItem. String-literal keys narrow to that literal; wider StorageItemKey values stay as the union.
Source
packages/storage/dist/index.d.mts:532
onValidationError
readonlyonValidationError:OnValidationError<TValue>
The onValidationError policy in effect at read-time.
Source
packages/storage/dist/index.d.mts:543
schema
readonlyschema:TSchema
The schema passed at define-time, or undefined.
Source
packages/storage/dist/index.d.mts:545
version
readonlyversion:TVersion
The schema version, captured as a numeric literal when passed directly.
Source
packages/storage/dist/index.d.mts:539
Methods
getMeta()
getMeta():
Promise<NullablePartial<TMetadata>>
Get metadata.
Source
packages/storage/dist/index.d.mts:556
getValue()
getValue():
Promise<TValue>
Get the latest value from storage.
Source
packages/storage/dist/index.d.mts:554
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:574
removeMeta()
removeMeta(
properties?):Promise<void>
Remove all metadata or certain properties from metadata.
Parameters
▪ properties?: string[]
Source
packages/storage/dist/index.d.mts:564
removeValue()
removeValue(
opts?):Promise<void>
Remove the value from storage.
Parameters
▪ opts?: RemoveItemOptions
Source
packages/storage/dist/index.d.mts:562
setMeta()
setMeta(
properties):Promise<void>
Set metadata properties.
Parameters
▪ properties: NullablePartial<TMetadata>
Source
packages/storage/dist/index.d.mts:560
setValue()
setValue(
value):Promise<void>
Set the value in storage.
Parameters
▪ value: TValue
Source
packages/storage/dist/index.d.mts:558
watch()
watch(
cb):Unwatch
Listen for changes to the value in storage.
Parameters
▪ cb: WatchCallback<TValue>
Source
packages/storage/dist/index.d.mts:566
Generated using typedoc-plugin-markdown and TypeDoc