|
1 |
| -chrome.devtools.panels.create( |
2 |
| - 'JSDiff', |
3 |
| - '/src/img/panel-icon28.png', |
4 |
| - '/src/jsdiff-panel.html', |
5 |
| - (panel) => { |
6 |
| - panel.onSearch.addListener(async (cmd, query) => { |
7 |
| - await chrome.runtime.sendMessage({ |
8 |
| - source: 'jsdiff-panel-search', |
9 |
| - params: { cmd, query }, |
10 |
| - }); |
11 |
| - }); |
12 |
| - } |
13 |
| -); |
14 |
| - |
15 | 1 | // tabId may be null if user opened the devtools of the devtools
|
16 | 2 | if (chrome.devtools.inspectedWindow.tabId !== null) {
|
| 3 | + chrome.devtools.panels.create( |
| 4 | + 'JSDiff', |
| 5 | + '/src/img/panel-icon28.png', |
| 6 | + '/src/jsdiff-panel.html', |
| 7 | + (panel) => { |
| 8 | + panel.onSearch.addListener(async (cmd, query) => { |
| 9 | + await chrome.runtime.sendMessage({ |
| 10 | + source: 'jsdiff-panel-search', |
| 11 | + params: { cmd, query }, |
| 12 | + }); |
| 13 | + }); |
| 14 | + } |
| 15 | + ); |
| 16 | + |
17 | 17 | injectScripts();
|
18 |
| -} |
19 | 18 |
|
20 |
| -// listen on tabs page reload |
21 |
| -chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { |
22 |
| - if ('complete' === changeInfo.status) { |
23 |
| - injectScripts(); |
24 |
| - } |
25 |
| -}); |
| 19 | + // listen on tabs page reload |
| 20 | + chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { |
| 21 | + if ('complete' === changeInfo.status) { |
| 22 | + injectScripts(); |
| 23 | + } |
| 24 | + }); |
26 | 25 |
|
27 |
| -// track api invocation - (api can be invoked prior opening of jsdiff panel) |
28 |
| -chrome.runtime.onMessage.addListener(async (req) => { |
29 |
| - if ('jsdiff-devtools-extension-api' === req.source) { |
30 |
| - await chrome.storage.local.set({ lastApiReq: req }); |
31 |
| - } |
32 |
| -}); |
| 26 | + // track api invocation - (api can be invoked prior opening of jsdiff panel) |
| 27 | + chrome.runtime.onMessage.addListener(async (req) => { |
| 28 | + if ('jsdiff-devtools-extension-api' === req.source) { |
| 29 | + await chrome.storage.local.set({ lastApiReq: req }); |
| 30 | + } |
| 31 | + }); |
| 32 | +} |
33 | 33 |
|
34 | 34 | // Inject console api and messaging proxy
|
35 | 35 | // us shown at: https://developer.chrome.com/extensions/devtools#content-script-to-devtools
|
|
0 commit comments