@wxt-dev/storage 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +7 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -103,6 +103,10 @@ interface WxtStorage {
|
|
|
103
103
|
item: WxtStorageItem<any, any>;
|
|
104
104
|
options?: RemoveItemOptions;
|
|
105
105
|
}>): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Removes all items from the provided storage area.
|
|
108
|
+
*/
|
|
109
|
+
clear(base: StorageArea): Promise<void>;
|
|
106
110
|
/**
|
|
107
111
|
* Remove the entire metadata for a key, or specific properties by name.
|
|
108
112
|
*
|
|
@@ -134,7 +138,7 @@ interface WxtStorage {
|
|
|
134
138
|
/**
|
|
135
139
|
* Define a storage item with a default value, type, or versioning.
|
|
136
140
|
*
|
|
137
|
-
* Read full docs: https://wxt.dev/
|
|
141
|
+
* Read full docs: https://wxt.dev/storage.html#defining-storage-items
|
|
138
142
|
*/
|
|
139
143
|
defineItem<TValue, TMetadata extends Record<string, unknown> = {}>(key: StorageItemKey): WxtStorageItem<TValue | null, TMetadata>;
|
|
140
144
|
defineItem<TValue, TMetadata extends Record<string, unknown> = {}>(key: StorageItemKey, options: WxtStorageItemOptions<TValue>): WxtStorageItem<TValue, TMetadata>;
|
package/dist/index.d.ts
CHANGED
|
@@ -103,6 +103,10 @@ interface WxtStorage {
|
|
|
103
103
|
item: WxtStorageItem<any, any>;
|
|
104
104
|
options?: RemoveItemOptions;
|
|
105
105
|
}>): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Removes all items from the provided storage area.
|
|
108
|
+
*/
|
|
109
|
+
clear(base: StorageArea): Promise<void>;
|
|
106
110
|
/**
|
|
107
111
|
* Remove the entire metadata for a key, or specific properties by name.
|
|
108
112
|
*
|
|
@@ -134,7 +138,7 @@ interface WxtStorage {
|
|
|
134
138
|
/**
|
|
135
139
|
* Define a storage item with a default value, type, or versioning.
|
|
136
140
|
*
|
|
137
|
-
* Read full docs: https://wxt.dev/
|
|
141
|
+
* Read full docs: https://wxt.dev/storage.html#defining-storage-items
|
|
138
142
|
*/
|
|
139
143
|
defineItem<TValue, TMetadata extends Record<string, unknown> = {}>(key: StorageItemKey): WxtStorageItem<TValue | null, TMetadata>;
|
|
140
144
|
defineItem<TValue, TMetadata extends Record<string, unknown> = {}>(key: StorageItemKey, options: WxtStorageItemOptions<TValue>): WxtStorageItem<TValue, TMetadata>;
|
package/dist/index.mjs
CHANGED
|
@@ -267,6 +267,10 @@ function createStorage() {
|
|
|
267
267
|
})
|
|
268
268
|
);
|
|
269
269
|
},
|
|
270
|
+
clear: async (base) => {
|
|
271
|
+
const driver = getDriver(base);
|
|
272
|
+
await driver.clear();
|
|
273
|
+
},
|
|
270
274
|
removeMeta: async (key, properties) => {
|
|
271
275
|
const { driver, driverKey } = resolveKey(key);
|
|
272
276
|
await removeMeta(driver, driverKey, properties);
|
|
@@ -459,6 +463,9 @@ function createDriver(storageArea) {
|
|
|
459
463
|
removeItems: async (keys) => {
|
|
460
464
|
await getStorageArea().remove(keys);
|
|
461
465
|
},
|
|
466
|
+
clear: async () => {
|
|
467
|
+
await getStorageArea().clear();
|
|
468
|
+
},
|
|
462
469
|
snapshot: async () => {
|
|
463
470
|
return await getStorageArea().get();
|
|
464
471
|
},
|