/javascripts/lib/docs/source/Element.keys.html

https://bitbucket.org/ksokmesa/sina-asian · HTML · 59 lines · 58 code · 1 blank · 0 comment · 0 complexity · 036b4ae86017d99ed07cc2b06c7234e9 MD5 · raw file

  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. */
  18. Ext.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. <div id="method-Ext.Element-addKeyMap"></div>/**
  48. * Creates a KeyMap for this element
  49. * @param {Object} config The KeyMap config. See {@link Ext.KeyMap} for more details
  50. * @return {Ext.KeyMap} The KeyMap created
  51. */
  52. addKeyMap : function(config){
  53. return new Ext.KeyMap(this, config);
  54. }
  55. });
  56. </pre>
  57. </body>
  58. </html>