* handles a keydown event * * @param {Event} e * @returns void
(e)
| 550 | * @returns void |
| 551 | */ |
| 552 | function _handleKeyEvent(e) { |
| 553 | |
| 554 | // normalize e.which for key events |
| 555 | // @see http://stackoverflow.com/questions/4285627/javascript-keycode-vs-charcode-utter-confusion |
| 556 | if (typeof e.which !== 'number') { |
| 557 | e.which = e.keyCode; |
| 558 | } |
| 559 | |
| 560 | var character = _characterFromEvent(e); |
| 561 | |
| 562 | // no character found then stop |
| 563 | if (!character) { |
| 564 | return; |
| 565 | } |
| 566 | |
| 567 | // need to use === for the character check because the character can be 0 |
| 568 | if (e.type == 'keyup' && _ignoreNextKeyup === character) { |
| 569 | _ignoreNextKeyup = false; |
| 570 | return; |
| 571 | } |
| 572 | |
| 573 | Mousetrap.handleKey(character, _eventModifiers(e), e); |
| 574 | } |
| 575 | |
| 576 | /** |
| 577 | * determines if the keycode specified is a modifier key or not |
nothing calls this directly
no test coverage detected