Function tinykeys
- tinykeys(target, keyBindingMap, __namedParameters?): (() => void)
Parameters
- target: HTMLElement | Window
- keyBindingMap: KeyBindingMap
Optional
__namedParameters: KeyBindingOptions
Returns (() => void)
- (): void
Returns void
Example
import { tinykeys } from "../src/tinykeys"
tinykeys(window, {
"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")
},
})
Subscribes to keybindings.
Returns an unsubscribe method.