Class: Accelerators

Accelerators

new Accelerators (options)

Handles all keyboard input for the menu and user-registered keys registered through Menu.GlobalAccelerator

Name Type Description
options object
Name Type Description
div HTMLElement optional

used for global accelerators (usually attached to document.body)

menu Menu optional

Menu to attach accelerators

Methods

clearKeys ()

clear all user-registered keys

register (keyCode, callback)

register a key as a global accelerator

Name Type Description
keyCode KeyCodes

(e.g., Ctrl+shift+E)

callback function

Type Definitions

KeyCodes string

Keycodes definition. In the form of modifier[+modifier...]+key

For example: ctrl+shift+e

KeyCodes are case insensitive (i.e., shift+a is the same as Shift+A)

Modifiers:
   ctrl, alt, shift, meta, (ctrl aliases: command, control, commandorcontrol)

Keys:
   escape, 0-9, minus, equal, backspace, tab, a-z, backetleft, bracketright, semicolon, quote,
   backquote, backslash, comma, period, slash, numpadmultiply, space, capslock, f1-f24, pause,
   scrolllock, printscreen, home, arrowup, arrowleft, arrowright, arrowdown, pageup, pagedown,
   end, insert, delete, enter, shiftleft, shiftright, ctrlleft, ctrlright, altleft, altright, shiftleft,
   shiftright, numlock, numpad...
For OS-specific codes and a more detailed explanation see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code. Also note that 'Digit' and 'Key' are removed from the code to make it easier to type.