|
1 |
| -const context = () => { |
| 1 | +const context = async () => { |
2 | 2 | if (context.ran) {
|
3 | 3 | return;
|
4 | 4 | }
|
5 | 5 | context.ran = true;
|
6 | 6 |
|
7 |
| - chrome.storage.local.get({ |
| 7 | + const prefs = await chrome.storage.local.get({ |
8 | 8 | 'mode': 'blacklist'
|
9 |
| - }, prefs => { |
10 |
| - // we do not support custom mode on m3 anymore |
11 |
| - chrome.contextMenus.create({ |
12 |
| - id: 'blacklist', |
13 |
| - title: 'Switch to "black-list" mode', |
14 |
| - contexts: ['action'], |
15 |
| - type: 'radio', |
16 |
| - checked: prefs.mode === 'blacklist' |
17 |
| - }, () => chrome.runtime.lastError); |
18 |
| - chrome.contextMenus.create({ |
19 |
| - id: 'whitelist', |
20 |
| - title: 'Switch to "white-list" mode', |
21 |
| - contexts: ['action'], |
22 |
| - type: 'radio', |
23 |
| - checked: prefs.mode === 'whitelist' |
24 |
| - }, () => chrome.runtime.lastError); |
25 |
| - chrome.contextMenus.create({ |
26 |
| - id: 'custom', |
27 |
| - title: 'Switch to "custom" mode', |
28 |
| - contexts: ['action'], |
29 |
| - type: 'radio', |
30 |
| - checked: prefs.mode === 'custom' |
31 |
| - }, () => chrome.runtime.lastError); |
32 |
| - |
33 |
| - chrome.contextMenus.create({ |
34 |
| - id: 'pause-tab', |
35 |
| - title: 'Pause on This Tab', |
36 |
| - contexts: ['action'] |
37 |
| - }, () => chrome.runtime.lastError); |
38 |
| - chrome.contextMenus.create({ |
39 |
| - id: 'resume-tab', |
40 |
| - title: 'Resume on This Tab', |
41 |
| - contexts: ['action'] |
42 |
| - }, () => chrome.runtime.lastError); |
43 | 9 | });
|
| 10 | + // we do not support custom mode on m3 anymore |
| 11 | + chrome.contextMenus.create({ |
| 12 | + id: 'blacklist', |
| 13 | + title: 'Switch to "black-list" mode', |
| 14 | + contexts: ['action'], |
| 15 | + type: 'radio', |
| 16 | + checked: prefs.mode === 'blacklist' |
| 17 | + }, () => chrome.runtime.lastError); |
| 18 | + chrome.contextMenus.create({ |
| 19 | + id: 'whitelist', |
| 20 | + title: 'Switch to "white-list" mode', |
| 21 | + contexts: ['action'], |
| 22 | + type: 'radio', |
| 23 | + checked: prefs.mode === 'whitelist' |
| 24 | + }, () => chrome.runtime.lastError); |
| 25 | + chrome.contextMenus.create({ |
| 26 | + id: 'custom', |
| 27 | + title: 'Switch to "custom" mode', |
| 28 | + contexts: ['action'], |
| 29 | + type: 'radio', |
| 30 | + checked: prefs.mode === 'custom' |
| 31 | + }, () => chrome.runtime.lastError); |
| 32 | + |
| 33 | + chrome.contextMenus.create({ |
| 34 | + id: 'pause-tab', |
| 35 | + title: 'Pause on This Tab', |
| 36 | + contexts: ['action'] |
| 37 | + }, () => chrome.runtime.lastError); |
| 38 | + chrome.contextMenus.create({ |
| 39 | + id: 'resume-tab', |
| 40 | + title: 'Resume on This Tab', |
| 41 | + contexts: ['action'] |
| 42 | + }, () => chrome.runtime.lastError); |
44 | 43 | };
|
45 | 44 |
|
46 | 45 | chrome.contextMenus.onClicked.addListener((info, tab) => {
|
|
0 commit comments