You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WXT provides a simplified API to replace the `browser.storage.*` APIs. Use the `storage` auto-import from `wxt/storage` or import it manually to get started:
9
+
A simplified wrapper around the extension storage APIs.
10
+
11
+
## Installation
12
+
13
+
### With WXT
14
+
15
+
This module is built-in to WXT, so you don't need to install anything.
10
16
11
17
```ts
12
18
import { storage } from'wxt/storage';
13
19
```
14
20
15
-
> [!IMPORTANT]
16
-
> To use the `wxt/storage` API, the `"storage"` permission must be added to the manifest:
17
-
>
18
-
> ```ts
19
-
>// wxt.config.ts
20
-
>exportdefaultdefineConfig({
21
-
> manifest: {
22
-
> permissions: ['storage'],
23
-
> },
24
-
> });
25
-
>```
21
+
If you use auto-imports, `storage` is auto-imported for you, so you don't even need to import it!
22
+
23
+
### Without WXT
24
+
25
+
Install the NPM package:
26
+
27
+
```sh
28
+
npm i @wxt-dev/storage
29
+
pnpm add @wxt-dev/storage
30
+
yarn add @wxt-dev/storage
31
+
bun add @wxt-dev/storage
32
+
```
33
+
34
+
```ts
35
+
import { storage } from'@wxt-dev/storage';
36
+
```
37
+
38
+
## Storage Permission
39
+
40
+
To use the `wxt/storage` API, the `"storage"` permission must be added to the manifest:
0 commit comments