diff options
Diffstat (limited to 'src/background/index.js')
-rw-r--r-- | src/background/index.js | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/background/index.js b/src/background/index.js index f329a9c..cbd4721 100644 --- a/src/background/index.js +++ b/src/background/index.js @@ -56,18 +56,11 @@ const keyQueueChanged = (sendToTab, state) => { return browser.tabs.sendMessage(sendToTab.id, action); }; -const handleMessage = (action, sendToTab) => { - backgroundStore.dispatch(action); - - return browser.tabs.sendMessage(sendToTab.id, action); -}; - -browser.runtime.onMessage.addListener((action, sender) => { - handleMessage(action, sender.tab); -}); - browser.runtime.onMessage.addListener((message) => { switch (message.type) { + case messages.KEYDOWN: + backgroundStore.dispatch(inputActions.keyPress(message.code, message.ctrl)); + break; case messages.CONSOLE_BLURRED: backgroundStore.dispatch(consoleActions.hide()); break; |