diff --git a/popup/tabswiper/modules/keyboardHandlers.js b/popup/tabswiper/modules/keyboardHandlers.js new file mode 100644 index 0000000..d6b10d0 --- /dev/null +++ b/popup/tabswiper/modules/keyboardHandlers.js @@ -0,0 +1,21 @@ +export const attachKeyboardHandlers = (store) => { + document.addEventListener('keydown', (e) => { + switch (e.key) { + case 'd': + case 'ArrowLeft': + store.actions.closeTab(store.getCurrentState().currentTab) + return + case 'k': + case 'ArrowRight': + store.actions.keepTab(store.getCurrentState().currentTab) + return + case 'f': + store.actions.goToTab(store.getCurrentState().currentTab) + return + case 'r': + location.reload() + return + } + }) +} +