Applied fixed to all code snippets in README.md so that they are syntactically valid.
This commit is contained in:
parent
0fd508671a
commit
a7cbdcc23e
12
README.md
12
README.md
|
@ -115,11 +115,11 @@ API, retrieve a list of tabs which match any of them, reload each of those
|
|||
tabs, and notify the user that is has been done:
|
||||
|
||||
```javascript
|
||||
browser.storage.get("urls").then(({urls}) => {
|
||||
browser.storage.local.get("urls").then(({urls}) => {
|
||||
return browser.tabs.query({url: urls});
|
||||
}).then(tabs => {
|
||||
return Promise.all(
|
||||
Array.from(tabs, tab => browser.tabs.reload(tab.id)));
|
||||
Array.from(tabs, tab => browser.tabs.reload(tab.id))
|
||||
);
|
||||
}).then(() => {
|
||||
return browser.notifications.create({
|
||||
|
@ -138,12 +138,12 @@ Or, using an async function:
|
|||
```javascript
|
||||
async function reloadTabs() {
|
||||
try {
|
||||
let {urls} = await browser.storage.get("urls");
|
||||
let {urls} = await browser.storage.local.get("urls");
|
||||
|
||||
let tabs = await browser.tabs.query({url: urls});
|
||||
|
||||
await Promise.all(
|
||||
Array.from(tabs, tab => browser.tabs.reload(tab.id)));
|
||||
Array.from(tabs, tab => browser.tabs.reload(tab.id))
|
||||
);
|
||||
|
||||
await browser.notifications.create({
|
||||
|
@ -173,7 +173,7 @@ And like this from the content script:
|
|||
```javascript
|
||||
browser.runtime.onMessage.addListener(msg => {
|
||||
if (msg == "get-ids") {
|
||||
return browser.storage.get("idPattern").then(({idPattern}) => {
|
||||
return browser.storage.local.get("idPattern").then(({idPattern}) => {
|
||||
return Array.from(document.querySelectorAll(idPattern),
|
||||
elem => elem.textContent);
|
||||
});
|
||||
|
@ -186,7 +186,7 @@ or:
|
|||
```javascript
|
||||
browser.runtime.onMessage.addListener(async function(msg) {
|
||||
if (msg == "get-ids") {
|
||||
let {idPattern} = await browser.storage.get("idPattern");
|
||||
let {idPattern} = await browser.storage.local.get("idPattern");
|
||||
|
||||
return Array.from(document.querySelectorAll(idPattern),
|
||||
elem => elem.textContent);
|
||||
|
|
Loading…
Reference in New Issue