github / hotkey

Trigger an action on an element with a keyboard shortcut.
https://github.github.com/hotkey/
MIT License
3.22k stars 97 forks source link

Register keydown handler on first install #10

Closed koddsson closed 5 years ago

koddsson commented 5 years ago

Rather then registering a global keyhandler for the consumers of github/hotkey, this PR exposes the keydown handler and puts the onus of registering it on the consumer.

cc/ @muan

koddsson commented 5 years ago

Hmm I think it makes more sense for this to be handled by the first install instead of having a separate keydown handler. Wdyt?

Oh yeah, I remember you mentioning this now. Maybe keep a count of elements installed as well and then remove the keydown handler when the last element is uninstalled?