(key-name? event key-name)
Returns true if the supplied key event involves the key(s) described by key-name.
Source
(defn
key-name?
"Returns true if the supplied key event involves the key(s) described by key-name."
[event key-name]
(let
[code (key-code event)]
(case
key-name
:undo-or-redo
(and (or (.-metaKey event) (.-ctrlKey event)) (= code 90))
:tab
(= code 9)
:enter
(= code 13)
:arrows
(contains? #{39 40 38 37} code)
:up-arrow
(= code 38)
:down-arrow
(= code 40)
:general
(not
(or
(contains? #{0 91 93 17 16 18} code)
(.-ctrlKey event)
(.-metaKey event)))
false)))