Skip to content

Commit

Permalink
Align managed storage snippet with favorite color example (mdn#20254)
Browse files Browse the repository at this point in the history
* Align managed storage snippet with favorite color example

* Addressed feedback

* Removed space
  • Loading branch information
rebloor committed Sep 8, 2022
1 parent eda0953 commit e106177
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,21 @@ Here's an example manifest:

```json
{
"name": "favorite-color[email protected]",
"name": "favourite-colour[email protected]",
"description": "ignored",
"type": "storage",
"data":
{
"color": "management thinks it should be blue!"
"data": {
"colour": "management thinks it should be blue!"
}
}
```

Given this manifest, the "favorite-color-examples\@mozilla.org" extension could access the data using code like this:
Given this manifest, the [favourite-colour](https://github.com/mdn/webextensions-examples/tree/master/favourite-colour) extension could access the data using code like this:

```js
let storageItem = browser.storage.managed.get('color');
let storageItem = browser.storage.managed.get('colour');
storageItem.then((res) => {
console.log(`Managed color is: ${res.color}`);
console.log(`Managed colour is: ${res.colour}`);
});
```

Expand Down

0 comments on commit e106177

Please sign in to comment.