blob: 8c9c418d9a77fb8a14e96806bf7d28cfe18c32d0 (
plain) (
blame)
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
|
import * as tabs from './tabs';
const KEY_MAP = {
'tabs.prev': KeyboardEvent.DOM_VK_H,
'tabs.next': KeyboardEvent.DOM_VK_L,
'scroll.up': KeyboardEvent.DOM_VK_K,
'scroll.down': KeyboardEvent.DOM_VK_J
};
browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
let response = null;
switch (request.code) {
case KEY_MAP['tabs.prev']:
tabs.selectPrevTab(sender.tab.index);
break;
case KEY_MAP['tabs.next']:
tabs.selectNextTab(sender.tab.index);
break;
case KEY_MAP['scroll.up']:
response = 'scroll.up'
break;
case KEY_MAP['scroll.down']:
response = 'scroll.down'
break;
}
sendResponse(response);
});
|