Skip to content

Commit 38a5a2c

Browse files
alegal200aklinker1
andauthored
docs: Document required permission for storage API (#632)
Co-authored-by: Aaron <[email protected]>
1 parent 21106ce commit 38a5a2c

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

docs/guide/storage.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@ WXT provides a simplified API to replace the `browser.storage.*` APIs. Use the `
1010
import { storage } from 'wxt/storage';
1111
```
1212

13+
:::warning
14+
To use the `wxt/storage` API, the `"storage"` permission must be added to the manifest:
15+
16+
```ts
17+
// wxt.config.ts
18+
export default defineConfig({
19+
manifest: {
20+
permissions: ['storage'],
21+
},
22+
});
23+
```
24+
25+
More info on permissions [here](/guide/manifest#permissions).
26+
:::
27+
1328
[[toc]]
1429

1530
## Basic Usage
@@ -117,7 +132,7 @@ Now, instead of using the `storage` variable, you can use the helper functions o
117132
await showChangelogOnUpdate.getValue();
118133
await showChangelogOnUpdate.setValue(false);
119134
await showChangelogOnUpdate.removeValue();
120-
const unwatch = showChangelogOnUpdate.watch(() => {
135+
const unwatch = showChangelogOnUpdate.watch((newValue) => {
121136
// ...
122137
});
123138
```

0 commit comments

Comments
 (0)