JavaScript github.com

A tiny JS library for keybindings  ↦

Yes, you can do keybindings directly. But for a mere ~400 bytes you can do keybindings like this instead:

import tinykeys from "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+KeyD": () => {
    alert("Either 'Control+d' or 'Meta+d' were pressed")
  },
})

Discussion

Sign in or Join to comment or subscribe

0:00 / 0:00