Skip to content

API > wxt/utils/storage > WxtStorageItemOptions

Interface: WxtStorageItemOptions<T> ​

Contents ​

Type parameters ​

▪ T

Properties ​

debug ​

debug?: boolean

Print debug logs, such as migration process.

Default ​

ts
false

Source ​

packages/storage/dist/index.d.mts:235


defaultValue ​

defaultValue?: T

Deprecated ​

Renamed to fallback, use it instead.

Source ​

packages/storage/dist/index.d.mts:209


fallback ​

fallback?: T

Default value returned when getValue would otherwise return null.

Source ​

packages/storage/dist/index.d.mts:211


init ​

init?: () => T | Promise<T>

If passed, a value in storage will be initialized immediately after defining the storage item. This function returns the value that will be saved to storage during the initialization process if a value doesn't already exist.

Source ​

packages/storage/dist/index.d.mts:218


migrations ​

migrations?: Record<number, (oldValue) => any>

A map of version numbers to the functions used to migrate the data to that version.

Source ​

packages/storage/dist/index.d.mts:229


onMigrationComplete ​

onMigrationComplete?: (migratedValue, targetVersion) => void

A callback function that runs on migration complete.

Parameters ​

▪ migratedValue: T

▪ targetVersion: number

Source ​

packages/storage/dist/index.d.mts:237


version ​

version?: number

Provide a version number for the storage item to enable migrations. When changing the version in the future, migration functions will be ran on application startup.

Source ​

packages/storage/dist/index.d.mts:224


Generated using typedoc-plugin-markdown and TypeDoc