Closed chocolateboy closed 5 years ago
Hey @chocolateboy and thanks for the PR ✨
I'm wondering what the benefit of denoting the hotkey as a JS variable over keeping it as-is on the element as a attribute?
This PR doesn't remove the data attribute. It's still available as the default/fallback way to define hotkeys. The optional parameter just provides more flexibility.
On a custom element or in a framework we might want to use, say, hotkey
rather than data-hotkey
. Or (data-)hotkeys
since there can be more than one. Or perhaps we're already using data-hotkey
for something else and don't want to change it. Or we want to assign hotkeys programatically per element ID or class. This PR adds the option to do so rather than forcing all users to comply with a hardwired API.
Thank you!
Allow the hotkey to be passed to the registering function (
install
) as an optional parameter, rather than requiring the use of thedata-hotkey
attribute. And update and expand the documentation (closes #5).