* picks the best action based on the key combination * * @param {string} key - character for key * @param {Array} modifiers * @param {string=} action passed in
(key, modifiers, action)
| 629 | * @param {string=} action passed in |
| 630 | */ |
| 631 | function _pickBestAction(key, modifiers, action) { |
| 632 | |
| 633 | // if no action was picked in we should try to pick the one |
| 634 | // that we think would work best for this key |
| 635 | if (!action) { |
| 636 | action = _getReverseMap()[key] ? 'keydown' : 'keypress'; |
| 637 | } |
| 638 | |
| 639 | // modifier keys don't work as expected with keypress, |
| 640 | // switch to keydown |
| 641 | if (action == 'keypress' && modifiers.length) { |
| 642 | action = 'keydown'; |
| 643 | } |
| 644 | |
| 645 | return action; |
| 646 | } |
| 647 | |
| 648 | /** |
| 649 | * binds a key sequence to an event |
no test coverage detected