-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbackground.js
28 lines (22 loc) · 911 Bytes
/
background.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require("core-js/stable");
require("regenerator-runtime/runtime");
const ContextMenu = require('./src/modules/context-menu.js');
const Options = require('./src/modules/options.js').Options;
const Commands = require('./src/modules/commands.js');
// #region Context menus
chrome.tabs.onCreated.addListener(ContextMenu.refresh);
chrome.tabs.onRemoved.addListener(ContextMenu.refresh);
chrome.windows.onCreated.addListener(ContextMenu.refresh);
chrome.windows.onFocusChanged.addListener(ContextMenu.refresh);
chrome.runtime.onStartup.addListener(ContextMenu.forceRefresh);
chrome.runtime.onInstalled.addListener(details => {
if (details.reason == "install") {
Options.setDefaults();
}
ContextMenu.forceRefresh();
});
chrome.contextMenus.onClicked.addListener(ContextMenu.onClicked);
// #endregion
// #region Commands
chrome.commands.onCommand.addListener(Commands.onCommand);
// #endregion