Function tinykeys
- tinykeys(
target: HTMLElement | Window,
keyBindingMap: KeyBindingMap,
__namedParameters?: KeyBindingOptions,
): () => void Parameters
- target: HTMLElement | Window
- keyBindingMap: KeyBindingMap
Optional
__namedParameters: KeyBindingOptions
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.