blob: b4c0bb06ebd11d390899a7e2fa647a23e0044de2 [file] [log] [blame]
Adrià Vilanova Martínez5f5b3e02023-07-23 00:08:17 +02001export default class UpdateNotifier {
2 getCommunityConsoleTabs() {
3 return new Promise(res => {
4 chrome.tabs.query(
5 {url: 'https://support.google.com/s/community*'}, tabs => res(tabs));
6 });
7 }
8
9 notify(reason) {
10 this.getCommunityConsoleTabs().then(tabs => {
11 for (const tab of tabs) {
12 const script = reason === 'install' ? 'handleInstall.bundle.js' :
13 'handleUpdate.bundle.js';
14 // #!if browser_target == 'chromium_mv3'
15 chrome.scripting.executeScript({
16 target: {tabId: tab.id},
17 files: [script],
18 });
19 // #!else
20 chrome.tabs.executeScript(tab.id, {file: script});
21 // #!endif
22 }
23 });
24 }
25}