Skip to content

API > wxt/storage > WxtStorageItem

Interface: WxtStorageItem<TValue, TMetadata>

Contents

Type parameters

TValue

TMetadata extends Record<string, unknown>

Properties

defaultValue

defaultValue: TValue

Source

packages/wxt/src/storage.ts:570

Methods

getMeta()

getMeta(): Promise<NullablePartial<TMetadata>>

Get metadata.

Source

packages/wxt/src/storage.ts:578


getValue()

getValue(): Promise<TValue>

Get the latest value from storage.

Source

packages/wxt/src/storage.ts:574


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/wxt/src/storage.ts:605


removeMeta()

removeMeta(properties?): Promise<void>

Remove all metadata or certain properties from metadata.

Parameters

properties?: string[]

Source

packages/wxt/src/storage.ts:594


removeValue()

removeValue(opts?): Promise<void>

Remove the value from storage.

Parameters

opts?: RemoveItemOptions

Source

packages/wxt/src/storage.ts:590


setMeta()

setMeta(properties): Promise<void>

Set metadata properties.

Parameters

properties: NullablePartial<TMetadata>

Source

packages/wxt/src/storage.ts:586


setValue()

setValue(value): Promise<void>

Set the value in storage.

Parameters

value: TValue

Source

packages/wxt/src/storage.ts:582


watch()

watch(cb): Unwatch

Listen for changes to the value in storage.

Parameters

cb: WatchCallback<TValue>

Source

packages/wxt/src/storage.ts:598


Generated using typedoc-plugin-markdown and TypeDoc