Namespace shortcuts
Description
Shortcuts
Methods
-
shortcut
- ch.onkeybackspace | ch.onkeytab | ch.onkeyenter | ch.onkeyesc | ch.onkeyleftarrow | ch.onkeyuparrow | ch.onkeyrightarrow | ch.onkeydownarrow : Shortcut to subscribe. -
name
- String : A name to add in the collection. -
callback
- Function : A given function. -
name
- String : A given name from the collection. -
name
- String : A given name from the collection. -
name
- String : A name to remove from the collection. -
shortcut
- ch.onkeybackspace | ch.onkeytab | ch.onkeyenter | ch.onkeyesc | ch.onkeyleftarrow | ch.onkeyuparrow | ch.onkeyrightarrow | ch.onkeydownarrow : Shortcut to unsubscribe. -
callback
- Function : A given function.
.add(shortcut, name, callback) → {Object}
Add a callback to a shortcut with given name.
// Add a callback to ESC key with "widget" name.
ch.shortcuts.add(ch.onkeyesc, 'widget', widget.hide);
.off(name) → {Object}
Turn off shortcuts associated to a given name.
// Turn off shortcuts associated to "widget" name.
ch.shortcuts.off('widget');
.on(name) → {Object}
Turn on shortcuts associated to a given name.
// Turn on shortcuts associated to "widget" name.
ch.shortcuts.on('widget');
.remove(name, shortcut, callback) → {Object}
Removes a callback from a shortcut with given name.
// Remove a callback from ESC key with "widget" name.
ch.shortcuts.remove(ch.onkeyesc, 'widget', widget.hide);