-
Notifications
You must be signed in to change notification settings - Fork 0
/
background.js
29 lines (28 loc) · 952 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
29
/**
* Returns all of the registered extension commands for this extension
* and their shortcut (if active).
*
* Since there is only one registered command in this sample extension,
* the returned `commandsArray` will look like the following:
* [{
* name: "toggle-feature",
* description: "Send a 'toggle-feature' event to the extension"
* shortcut: "Ctrl+Shift+U"
* }]
*/
var gettingAllCommands = browser.commands.getAll();
gettingAllCommands.then((commands) => {
for (let command of commands) {
console.log(command);
}
});
/**
* Fired when a registered command is activated using a keyboard shortcut.
*
* In this sample extension, there is only one registered command:
* "Ctrl+Shift+U". On Mac, this command will automatically be converted to
* "Command+Shift+U".
*/
browser.commands.onCommand.addListener((command) => {
console.log('onCommand event received for message: ', command);
});