feat: added ALT+Left/Right Arrow to move through pages, chore: added hidden features in README

This commit is contained in:
Roberto Tonino
2020-09-24 18:33:56 +02:00
parent 3c276405af
commit dace87887b
3 changed files with 31 additions and 5 deletions

View File

@@ -45,6 +45,7 @@ function mountApp() {
function initClient() {
store.dispatch('setClientMode', true)
setClientModeKeyBindings()
}
document.addEventListener('DOMContentLoaded', startApp)
@@ -78,6 +79,23 @@ document.addEventListener('keydown', e => {
}
})
/**
* Sets up key bindings that already work in the browser (server mode)
*/
function setClientModeKeyBindings() {
document.addEventListener('keyup', keyEvent => {
// ALT + left
if (keyEvent.altKey && keyEvent.key === 'ArrowLeft') {
router.back()
}
// ALT + right
if (keyEvent.altKey && keyEvent.key === 'ArrowRight') {
router.forward()
}
})
}
/* ===== Socketio listeners ===== */
// Debug messages for socketio