Class Roo.KeyMap

Package:Roo
Defined In: Roo/KeyMap.js.
Class:KeyMap
Handles mapping keys to actions for an element. One key map can be used for multiple actions.
The constructor accepts the same config object as defined by {link addBinding}.
If you bind a callback function to a KeyMap, anytime the KeyMap handles an expected key
combination it will call the function with this signature (if the match is a multi-key
combination the callback will still be called only once): (String key, Roo.EventObject e)
A KeyMap can also handle a string representation of keys.

Usage:

// map one key by key code
var map = new Roo.KeyMap("my-element", {
key: 13, // or Roo.EventObject.ENTER
fn: myHandler,
scope: myObject
});

// map multiple keys to one action by string
var map = new Roo.KeyMap("my-element", {
key: "a\r\n\t",
fn: myHandler,
scope: myObject
});

// map multiple keys to multiple actions by strings and array of codes
var map = new Roo.KeyMap("my-element", [
{
key: [10,13],
fn: function(){ alert("Return was pressed"); }
}, {
key: "abc",
fn: function(){ alert('a, b or c was pressed'); }
}, {
key: "\t",
ctrl:true,
shift:true,
fn: function(){ alert('Control + shift + tab was pressed.'); }
}
]);

Note: A KeyMap starts enabled
Class Comments / Notes => [Add Your comment/notes about this class]
Config Options - Has None
Public Properties - Has None
Public Methods
Method Defined By
Events - Has None
Documentation generated by Introspection Doc Generator on Fri Jul 13 2018 14:10:53 GMT+0800 (HKT) Based on JsDoc Toolkit