Class: Shortcut

Shortcut(hotkey, elementopt, callback)

new Shortcut(hotkey, elementopt, callback)

Parameters:
Name Type Attributes Description
hotkey Object | string Hotkey string or settings object
element Element | string <optional>
Bind to element
callback function function to trigger on hotkey

Members

(static) parse

Parses a hotkey string into a KeyEvent object

bind

Bind the event listener

check

Compares keyboard event with Shortcut data

disable

Sets enabled to false, shorthand for Shortcut#toggle(false)

enable

Sets enabled to true, shorthand for Shortcut#toggle(true)

(readonly) enabled :boolean

Gets enabled state.
Type:
  • boolean

hotkey :string

The hotkey string of the shortcut
Type:
  • string

toggle

Toggle the enabled state of the shortcut

unbind

Unbind the event listener

Type Definitions

HotKey

Type:
  • Object
Properties:
Name Type Description
keyEvent KeyEvent
preventDefault bool

KeyEvent

Type:
  • Object
Properties:
Name Type Description
keyCode string Numeric Key Code
ctrlKey bool Ctrl is pressed
shiftKey bool Shift is pressed
altKey bool Alt is pressed
metaKey bool Windows/Meta is pressed