/javascripts/lib/docs/source/Element.keys.html
HTML | 59 lines | 58 code | 1 blank | 0 comment | 0 complexity | 036b4ae86017d99ed07cc2b06c7234e9 MD5 | raw file
Possible License(s): GPL-3.0
1<html> 2<head> 3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 4 <title>The source code</title> 5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" /> 6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script> 7</head> 8<body onload="prettyPrint();"> 9 <pre class="prettyprint lang-js">/*! 10 * Ext JS Library 3.2.1 11 * Copyright(c) 2006-2010 Ext JS, Inc. 12 * licensing@extjs.com 13 * http://www.extjs.com/license 14 */ 15/** 16 * @class Ext.Element 17 */ 18Ext.Element.addMethods({ 19 <div id="method-Ext.Element-addKeyListener"></div>/** 20 * Convenience method for constructing a KeyMap 21 * @param {Number/Array/Object/String} key Either a string with the keys to listen for, the numeric key code, array of key codes or an object with the following options: 22 * <code>{key: (number or array), shift: (true/false), ctrl: (true/false), alt: (true/false)}</code> 23 * @param {Function} fn The function to call 24 * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the specified function is executed. Defaults to this Element. 25 * @return {Ext.KeyMap} The KeyMap created 26 */ 27 addKeyListener : function(key, fn, scope){ 28 var config; 29 if(typeof key != 'object' || Ext.isArray(key)){ 30 config = { 31 key: key, 32 fn: fn, 33 scope: scope 34 }; 35 }else{ 36 config = { 37 key : key.key, 38 shift : key.shift, 39 ctrl : key.ctrl, 40 alt : key.alt, 41 fn: fn, 42 scope: scope 43 }; 44 } 45 return new Ext.KeyMap(this, config); 46 }, 47 48 <div id="method-Ext.Element-addKeyMap"></div>/** 49 * Creates a KeyMap for this element 50 * @param {Object} config The KeyMap config. See {@link Ext.KeyMap} for more details 51 * @return {Ext.KeyMap} The KeyMap created 52 */ 53 addKeyMap : function(config){ 54 return new Ext.KeyMap(this, config); 55 } 56}); 57</pre> 58</body> 59</html>