Function createKeybindingsHandler
- create
Keybindings (keyBindingMap, options?): EventListenerHandler Parameters
- keyBindingMap: KeyBindingMap
Optional
options: KeyBindingHandlerOptions
Returns EventListener
Example
import { createKeybindingsHandler } from "../src/keybindings"
let handler = createKeybindingsHandler({
"Shift+d": () => {
alert("The 'Shift' and 'd' keys were pressed at the same time")
},
"y e e t": () => {
alert("The keys 'y', 'e', 'e', and 't' were pressed in order")
},
"$mod+d": () => {
alert("Either 'Control+d' or 'Meta+d' were pressed")
},
})
window.addEvenListener("keydown", handler)
Creates an event listener for handling keybindings.