API / wxt/utils/storage / WxtStorageItemOptions
Interface: WxtStorageItemOptions<T>
Source: packages/storage/dist/index.d.mts:203
Contents
Type Parameters
T
T
Properties
debug?
optionaldebug?:boolean
Source: packages/storage/dist/index.d.mts:231
Print debug logs, such as migration process.
Default
falsedefaultValue?
optionaldefaultValue?:T
Source: packages/storage/dist/index.d.mts:205
Deprecated
Renamed to fallback, use it instead.
fallback?
optionalfallback?:T
Source: packages/storage/dist/index.d.mts:207
Default value returned when getValue would otherwise return null.
init?
optionalinit?: () =>T|Promise<T>
Source: packages/storage/dist/index.d.mts:214
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.
Returns
T | Promise<T>
migrations?
optionalmigrations?:Record<number, (oldValue) =>any>
Source: packages/storage/dist/index.d.mts:225
A map of version numbers to the functions used to migrate the data to that version.
onMigrationComplete?
optionalonMigrationComplete?: (migratedValue,targetVersion) =>void
Source: packages/storage/dist/index.d.mts:233
A callback function that runs on migration complete.
Parameters
migratedValue
T
targetVersion
number
Returns
void
version?
optionalversion?:number
Source: packages/storage/dist/index.d.mts:220
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.
Generated using typedoc-plugin-markdown and TypeDoc