blob: b4c0bb06ebd11d390899a7e2fa647a23e0044de2 [file] [log] [blame]
export default class UpdateNotifier {
getCommunityConsoleTabs() {
return new Promise(res => {
chrome.tabs.query(
{url: 'https://support.google.com/s/community*'}, tabs => res(tabs));
});
}
notify(reason) {
this.getCommunityConsoleTabs().then(tabs => {
for (const tab of tabs) {
const script = reason === 'install' ? 'handleInstall.bundle.js' :
'handleUpdate.bundle.js';
// #!if browser_target == 'chromium_mv3'
chrome.scripting.executeScript({
target: {tabId: tab.id},
files: [script],
});
// #!else
chrome.tabs.executeScript(tab.id, {file: script});
// #!endif
}
});
}
}