You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

29 lines
673 B

import * as tabs from './tabs';
const KEY_MAP = {
7 years ago
'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;
7 years ago
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);
});