Ext.html 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js"><span id='Ext'>/**
  19. </span> * @class Ext
  20. * @singleton
  21. */
  22. var Ext = Ext || {};
  23. Ext._startTime = new Date().getTime();
  24. (function() {
  25. var global = this,
  26. objectPrototype = Object.prototype,
  27. toString = objectPrototype.toString,
  28. enumerables = true,
  29. enumerablesTest = { toString: 1 },
  30. emptyFn = function () {},
  31. // This is the &quot;$previous&quot; method of a hook function on an instance. When called, it
  32. // calls through the class prototype by the name of the called method.
  33. callOverrideParent = function () {
  34. var method = callOverrideParent.caller.caller; // skip callParent (our caller)
  35. return method.$owner.prototype[method.$name].apply(this, arguments);
  36. },
  37. i;
  38. Ext.global = global;
  39. for (i in enumerablesTest) {
  40. enumerables = null;
  41. }
  42. if (enumerables) {
  43. enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable',
  44. 'toLocaleString', 'toString', 'constructor'];
  45. }
  46. <span id='Ext-property-enumerables'> /**
  47. </span> * An array containing extra enumerables for old browsers
  48. * @property {String[]}
  49. */
  50. Ext.enumerables = enumerables;
  51. <span id='Ext-method-apply'> /**
  52. </span> * Copies all the properties of config to the specified object.
  53. * Note that if recursive merging and cloning without referencing the original objects / arrays is needed, use
  54. * {@link Ext.Object#merge} instead.
  55. * @param {Object} object The receiver of the properties
  56. * @param {Object} config The source of the properties
  57. * @param {Object} [defaults] A different object that will also be applied for default values
  58. * @return {Object} returns obj
  59. */
  60. Ext.apply = function(object, config, defaults) {
  61. if (defaults) {
  62. Ext.apply(object, defaults);
  63. }
  64. if (object &amp;&amp; config &amp;&amp; typeof config === 'object') {
  65. var i, j, k;
  66. for (i in config) {
  67. object[i] = config[i];
  68. }
  69. if (enumerables) {
  70. for (j = enumerables.length; j--;) {
  71. k = enumerables[j];
  72. if (config.hasOwnProperty(k)) {
  73. object[k] = config[k];
  74. }
  75. }
  76. }
  77. }
  78. return object;
  79. };
  80. Ext.buildSettings = Ext.apply({
  81. baseCSSPrefix: 'x-',
  82. scopeResetCSS: false
  83. }, Ext.buildSettings || {});
  84. Ext.apply(Ext, {
  85. <span id='Ext-property-name'> /**
  86. </span> * @property {String} [name='Ext']
  87. * &lt;p&gt;The name of the property in the global namespace (The &lt;code&gt;window&lt;/code&gt; in browser environments) which refers to the current instance of Ext.&lt;/p&gt;
  88. * &lt;p&gt;This is usually &lt;code&gt;&quot;Ext&quot;&lt;/code&gt;, but if a sandboxed build of ExtJS is being used, this will be an alternative name.&lt;/p&gt;
  89. * &lt;p&gt;If code is being generated for use by &lt;code&gt;eval&lt;/code&gt; or to create a &lt;code&gt;new Function&lt;/code&gt;, and the global instance
  90. * of Ext must be referenced, this is the name that should be built into the code.&lt;/p&gt;
  91. */
  92. name: Ext.sandboxName || 'Ext',
  93. <span id='Ext-property-emptyFn'> /**
  94. </span> * A reusable empty function
  95. */
  96. emptyFn: emptyFn,
  97. <span id='Ext-property-emptyString'> /**
  98. </span> * A zero length string which will pass a truth test. Useful for passing to methods
  99. * which use a truth test to reject &lt;i&gt;falsy&lt;/i&gt; values where a string value must be cleared.
  100. */
  101. emptyString: new String(),
  102. baseCSSPrefix: Ext.buildSettings.baseCSSPrefix,
  103. <span id='Ext-method-applyIf'> /**
  104. </span> * Copies all the properties of config to object if they don't already exist.
  105. * @param {Object} object The receiver of the properties
  106. * @param {Object} config The source of the properties
  107. * @return {Object} returns obj
  108. */
  109. applyIf: function(object, config) {
  110. var property;
  111. if (object) {
  112. for (property in config) {
  113. if (object[property] === undefined) {
  114. object[property] = config[property];
  115. }
  116. }
  117. }
  118. return object;
  119. },
  120. <span id='Ext-method-iterate'> /**
  121. </span> * Iterates either an array or an object. This method delegates to
  122. * {@link Ext.Array#each Ext.Array.each} if the given value is iterable, and {@link Ext.Object#each Ext.Object.each} otherwise.
  123. *
  124. * @param {Object/Array} object The object or array to be iterated.
  125. * @param {Function} fn The function to be called for each iteration. See and {@link Ext.Array#each Ext.Array.each} and
  126. * {@link Ext.Object#each Ext.Object.each} for detailed lists of arguments passed to this function depending on the given object
  127. * type that is being iterated.
  128. * @param {Object} scope (Optional) The scope (`this` reference) in which the specified function is executed.
  129. * Defaults to the object being iterated itself.
  130. * @markdown
  131. */
  132. iterate: function(object, fn, scope) {
  133. if (Ext.isEmpty(object)) {
  134. return;
  135. }
  136. if (scope === undefined) {
  137. scope = object;
  138. }
  139. if (Ext.isIterable(object)) {
  140. Ext.Array.each.call(Ext.Array, object, fn, scope);
  141. }
  142. else {
  143. Ext.Object.each.call(Ext.Object, object, fn, scope);
  144. }
  145. }
  146. });
  147. Ext.apply(Ext, {
  148. <span id='Ext-method-extend'> /**
  149. </span> * This method deprecated. Use {@link Ext#define Ext.define} instead.
  150. * @method
  151. * @param {Function} superclass
  152. * @param {Object} overrides
  153. * @return {Function} The subclass constructor from the &lt;tt&gt;overrides&lt;/tt&gt; parameter, or a generated one if not provided.
  154. * @deprecated 4.0.0 Use {@link Ext#define Ext.define} instead
  155. */
  156. extend: (function() {
  157. // inline overrides
  158. var objectConstructor = objectPrototype.constructor,
  159. inlineOverrides = function(o) {
  160. for (var m in o) {
  161. if (!o.hasOwnProperty(m)) {
  162. continue;
  163. }
  164. this[m] = o[m];
  165. }
  166. };
  167. return function(subclass, superclass, overrides) {
  168. // First we check if the user passed in just the superClass with overrides
  169. if (Ext.isObject(superclass)) {
  170. overrides = superclass;
  171. superclass = subclass;
  172. subclass = overrides.constructor !== objectConstructor ? overrides.constructor : function() {
  173. superclass.apply(this, arguments);
  174. };
  175. }
  176. //&lt;debug&gt;
  177. if (!superclass) {
  178. Ext.Error.raise({
  179. sourceClass: 'Ext',
  180. sourceMethod: 'extend',
  181. msg: 'Attempting to extend from a class which has not been loaded on the page.'
  182. });
  183. }
  184. //&lt;/debug&gt;
  185. // We create a new temporary class
  186. var F = function() {},
  187. subclassProto, superclassProto = superclass.prototype;
  188. F.prototype = superclassProto;
  189. subclassProto = subclass.prototype = new F();
  190. subclassProto.constructor = subclass;
  191. subclass.superclass = superclassProto;
  192. if (superclassProto.constructor === objectConstructor) {
  193. superclassProto.constructor = superclass;
  194. }
  195. subclass.override = function(overrides) {
  196. Ext.override(subclass, overrides);
  197. };
  198. subclassProto.override = inlineOverrides;
  199. subclassProto.proto = subclassProto;
  200. subclass.override(overrides);
  201. subclass.extend = function(o) {
  202. return Ext.extend(subclass, o);
  203. };
  204. return subclass;
  205. };
  206. }()),
  207. <span id='Ext-method-override'> /**
  208. </span> * Overrides members of the specified `target` with the given values.
  209. *
  210. * If the `target` is a class declared using {@link Ext#define Ext.define}, the
  211. * `override` method of that class is called (see {@link Ext.Base#override}) given
  212. * the `overrides`.
  213. *
  214. * If the `target` is a function, it is assumed to be a constructor and the contents
  215. * of `overrides` are applied to its `prototype` using {@link Ext#apply Ext.apply}.
  216. *
  217. * If the `target` is an instance of a class declared using {@link Ext#define Ext.define},
  218. * the `overrides` are applied to only that instance. In this case, methods are
  219. * specially processed to allow them to use {@link Ext.Base#callParent}.
  220. *
  221. * var panel = new Ext.Panel({ ... });
  222. *
  223. * Ext.override(panel, {
  224. * initComponent: function () {
  225. * // extra processing...
  226. *
  227. * this.callParent();
  228. * }
  229. * });
  230. *
  231. * If the `target` is none of these, the `overrides` are applied to the `target`
  232. * using {@link Ext#apply Ext.apply}.
  233. *
  234. * Please refer to {@link Ext#define Ext.define} and {@link Ext.Base#override} for
  235. * further details.
  236. *
  237. * @param {Object} target The target to override.
  238. * @param {Object} overrides The properties to add or replace on `target`.
  239. * @method override
  240. */
  241. override: function (target, overrides) {
  242. if (target.$isClass) {
  243. target.override(overrides);
  244. } else if (typeof target == 'function') {
  245. Ext.apply(target.prototype, overrides);
  246. } else {
  247. var owner = target.self,
  248. name, value;
  249. if (owner &amp;&amp; owner.$isClass) { // if (instance of Ext.define'd class)
  250. for (name in overrides) {
  251. if (overrides.hasOwnProperty(name)) {
  252. value = overrides[name];
  253. if (typeof value == 'function') {
  254. //&lt;debug&gt;
  255. if (owner.$className) {
  256. value.displayName = owner.$className + '#' + name;
  257. }
  258. //&lt;/debug&gt;
  259. value.$name = name;
  260. value.$owner = owner;
  261. value.$previous = target.hasOwnProperty(name)
  262. ? target[name] // already hooked, so call previous hook
  263. : callOverrideParent; // calls by name on prototype
  264. }
  265. target[name] = value;
  266. }
  267. }
  268. } else {
  269. Ext.apply(target, overrides);
  270. }
  271. }
  272. return target;
  273. }
  274. });
  275. // A full set of static methods to do type checking
  276. Ext.apply(Ext, {
  277. <span id='Ext-method-valueFrom'> /**
  278. </span> * Returns the given value itself if it's not empty, as described in {@link Ext#isEmpty}; returns the default
  279. * value (second argument) otherwise.
  280. *
  281. * @param {Object} value The value to test
  282. * @param {Object} defaultValue The value to return if the original value is empty
  283. * @param {Boolean} allowBlank (optional) true to allow zero length strings to qualify as non-empty (defaults to false)
  284. * @return {Object} value, if non-empty, else defaultValue
  285. */
  286. valueFrom: function(value, defaultValue, allowBlank){
  287. return Ext.isEmpty(value, allowBlank) ? defaultValue : value;
  288. },
  289. <span id='Ext-method-typeOf'> /**
  290. </span> * Returns the type of the given variable in string format. List of possible values are:
  291. *
  292. * - `undefined`: If the given value is `undefined`
  293. * - `null`: If the given value is `null`
  294. * - `string`: If the given value is a string
  295. * - `number`: If the given value is a number
  296. * - `boolean`: If the given value is a boolean value
  297. * - `date`: If the given value is a `Date` object
  298. * - `function`: If the given value is a function reference
  299. * - `object`: If the given value is an object
  300. * - `array`: If the given value is an array
  301. * - `regexp`: If the given value is a regular expression
  302. * - `element`: If the given value is a DOM Element
  303. * - `textnode`: If the given value is a DOM text node and contains something other than whitespace
  304. * - `whitespace`: If the given value is a DOM text node and contains only whitespace
  305. *
  306. * @param {Object} value
  307. * @return {String}
  308. * @markdown
  309. */
  310. typeOf: function(value) {
  311. var type,
  312. typeToString;
  313. if (value === null) {
  314. return 'null';
  315. }
  316. type = typeof value;
  317. if (type === 'undefined' || type === 'string' || type === 'number' || type === 'boolean') {
  318. return type;
  319. }
  320. typeToString = toString.call(value);
  321. switch(typeToString) {
  322. case '[object Array]':
  323. return 'array';
  324. case '[object Date]':
  325. return 'date';
  326. case '[object Boolean]':
  327. return 'boolean';
  328. case '[object Number]':
  329. return 'number';
  330. case '[object RegExp]':
  331. return 'regexp';
  332. }
  333. if (type === 'function') {
  334. return 'function';
  335. }
  336. if (type === 'object') {
  337. if (value.nodeType !== undefined) {
  338. if (value.nodeType === 3) {
  339. return (/\S/).test(value.nodeValue) ? 'textnode' : 'whitespace';
  340. }
  341. else {
  342. return 'element';
  343. }
  344. }
  345. return 'object';
  346. }
  347. //&lt;debug error&gt;
  348. Ext.Error.raise({
  349. sourceClass: 'Ext',
  350. sourceMethod: 'typeOf',
  351. msg: 'Failed to determine the type of the specified value &quot;' + value + '&quot;. This is most likely a bug.'
  352. });
  353. //&lt;/debug&gt;
  354. },
  355. <span id='Ext-method-isEmpty'> /**
  356. </span> * Returns true if the passed value is empty, false otherwise. The value is deemed to be empty if it is either:
  357. *
  358. * - `null`
  359. * - `undefined`
  360. * - a zero-length array
  361. * - a zero-length string (Unless the `allowEmptyString` parameter is set to `true`)
  362. *
  363. * @param {Object} value The value to test
  364. * @param {Boolean} allowEmptyString (optional) true to allow empty strings (defaults to false)
  365. * @return {Boolean}
  366. * @markdown
  367. */
  368. isEmpty: function(value, allowEmptyString) {
  369. return (value === null) || (value === undefined) || (!allowEmptyString ? value === '' : false) || (Ext.isArray(value) &amp;&amp; value.length === 0);
  370. },
  371. <span id='Ext-method-isArray'> /**
  372. </span> * Returns true if the passed value is a JavaScript Array, false otherwise.
  373. *
  374. * @param {Object} target The target to test
  375. * @return {Boolean}
  376. * @method
  377. */
  378. isArray: ('isArray' in Array) ? Array.isArray : function(value) {
  379. return toString.call(value) === '[object Array]';
  380. },
  381. <span id='Ext-method-isDate'> /**
  382. </span> * Returns true if the passed value is a JavaScript Date object, false otherwise.
  383. * @param {Object} object The object to test
  384. * @return {Boolean}
  385. */
  386. isDate: function(value) {
  387. return toString.call(value) === '[object Date]';
  388. },
  389. <span id='Ext-method-isObject'> /**
  390. </span> * Returns true if the passed value is a JavaScript Object, false otherwise.
  391. * @param {Object} value The value to test
  392. * @return {Boolean}
  393. * @method
  394. */
  395. isObject: (toString.call(null) === '[object Object]') ?
  396. function(value) {
  397. // check ownerDocument here as well to exclude DOM nodes
  398. return value !== null &amp;&amp; value !== undefined &amp;&amp; toString.call(value) === '[object Object]' &amp;&amp; value.ownerDocument === undefined;
  399. } :
  400. function(value) {
  401. return toString.call(value) === '[object Object]';
  402. },
  403. <span id='Ext-method-isSimpleObject'> /**
  404. </span> * @private
  405. */
  406. isSimpleObject: function(value) {
  407. return value instanceof Object &amp;&amp; value.constructor === Object;
  408. },
  409. <span id='Ext-method-isPrimitive'> /**
  410. </span> * Returns true if the passed value is a JavaScript 'primitive', a string, number or boolean.
  411. * @param {Object} value The value to test
  412. * @return {Boolean}
  413. */
  414. isPrimitive: function(value) {
  415. var type = typeof value;
  416. return type === 'string' || type === 'number' || type === 'boolean';
  417. },
  418. <span id='Ext-method-isFunction'> /**
  419. </span> * Returns true if the passed value is a JavaScript Function, false otherwise.
  420. * @param {Object} value The value to test
  421. * @return {Boolean}
  422. * @method
  423. */
  424. isFunction:
  425. // Safari 3.x and 4.x returns 'function' for typeof &lt;NodeList&gt;, hence we need to fall back to using
  426. // Object.prototype.toString (slower)
  427. (typeof document !== 'undefined' &amp;&amp; typeof document.getElementsByTagName('body') === 'function') ? function(value) {
  428. return toString.call(value) === '[object Function]';
  429. } : function(value) {
  430. return typeof value === 'function';
  431. },
  432. <span id='Ext-method-isNumber'> /**
  433. </span> * Returns true if the passed value is a number. Returns false for non-finite numbers.
  434. * @param {Object} value The value to test
  435. * @return {Boolean}
  436. */
  437. isNumber: function(value) {
  438. return typeof value === 'number' &amp;&amp; isFinite(value);
  439. },
  440. <span id='Ext-method-isNumeric'> /**
  441. </span> * Validates that a value is numeric.
  442. * @param {Object} value Examples: 1, '1', '2.34'
  443. * @return {Boolean} True if numeric, false otherwise
  444. */
  445. isNumeric: function(value) {
  446. return !isNaN(parseFloat(value)) &amp;&amp; isFinite(value);
  447. },
  448. <span id='Ext-method-isString'> /**
  449. </span> * Returns true if the passed value is a string.
  450. * @param {Object} value The value to test
  451. * @return {Boolean}
  452. */
  453. isString: function(value) {
  454. return typeof value === 'string';
  455. },
  456. <span id='Ext-method-isBoolean'> /**
  457. </span> * Returns true if the passed value is a boolean.
  458. *
  459. * @param {Object} value The value to test
  460. * @return {Boolean}
  461. */
  462. isBoolean: function(value) {
  463. return typeof value === 'boolean';
  464. },
  465. <span id='Ext-method-isElement'> /**
  466. </span> * Returns true if the passed value is an HTMLElement
  467. * @param {Object} value The value to test
  468. * @return {Boolean}
  469. */
  470. isElement: function(value) {
  471. return value ? value.nodeType === 1 : false;
  472. },
  473. <span id='Ext-method-isTextNode'> /**
  474. </span> * Returns true if the passed value is a TextNode
  475. * @param {Object} value The value to test
  476. * @return {Boolean}
  477. */
  478. isTextNode: function(value) {
  479. return value ? value.nodeName === &quot;#text&quot; : false;
  480. },
  481. <span id='Ext-method-isDefined'> /**
  482. </span> * Returns true if the passed value is defined.
  483. * @param {Object} value The value to test
  484. * @return {Boolean}
  485. */
  486. isDefined: function(value) {
  487. return typeof value !== 'undefined';
  488. },
  489. <span id='Ext-method-isIterable'> /**
  490. </span> * Returns true if the passed value is iterable, false otherwise
  491. * @param {Object} value The value to test
  492. * @return {Boolean}
  493. */
  494. isIterable: function(value) {
  495. var type = typeof value,
  496. checkLength = false;
  497. if (value &amp;&amp; type != 'string') {
  498. // Functions have a length property, so we need to filter them out
  499. if (type == 'function') {
  500. // In Safari, NodeList/HTMLCollection both return &quot;function&quot; when using typeof, so we need
  501. // to explicitly check them here.
  502. if (Ext.isSafari) {
  503. checkLength = value instanceof NodeList || value instanceof HTMLCollection;
  504. }
  505. } else {
  506. checkLength = true;
  507. }
  508. }
  509. return checkLength ? value.length !== undefined : false;
  510. }
  511. });
  512. Ext.apply(Ext, {
  513. <span id='Ext-method-clone'> /**
  514. </span> * Clone simple variables including array, {}-like objects, DOM nodes and Date without keeping the old reference.
  515. * A reference for the object itself is returned if it's not a direct decendant of Object. For model cloning,
  516. * see {@link Ext.data.Model#copy Model.copy}.
  517. *
  518. * @param {Object} item The variable to clone
  519. * @return {Object} clone
  520. */
  521. clone: function(item) {
  522. var type,
  523. i,
  524. j,
  525. k,
  526. clone,
  527. key;
  528. if (item === null || item === undefined) {
  529. return item;
  530. }
  531. // DOM nodes
  532. // TODO proxy this to Ext.Element.clone to handle automatic id attribute changing
  533. // recursively
  534. if (item.nodeType &amp;&amp; item.cloneNode) {
  535. return item.cloneNode(true);
  536. }
  537. type = toString.call(item);
  538. // Date
  539. if (type === '[object Date]') {
  540. return new Date(item.getTime());
  541. }
  542. // Array
  543. if (type === '[object Array]') {
  544. i = item.length;
  545. clone = [];
  546. while (i--) {
  547. clone[i] = Ext.clone(item[i]);
  548. }
  549. }
  550. // Object
  551. else if (type === '[object Object]' &amp;&amp; item.constructor === Object) {
  552. clone = {};
  553. for (key in item) {
  554. clone[key] = Ext.clone(item[key]);
  555. }
  556. if (enumerables) {
  557. for (j = enumerables.length; j--;) {
  558. k = enumerables[j];
  559. clone[k] = item[k];
  560. }
  561. }
  562. }
  563. return clone || item;
  564. },
  565. <span id='Ext-method-getUniqueGlobalNamespace'> /**
  566. </span> * @private
  567. * Generate a unique reference of Ext in the global scope, useful for sandboxing
  568. */
  569. getUniqueGlobalNamespace: function() {
  570. var uniqueGlobalNamespace = this.uniqueGlobalNamespace,
  571. i;
  572. if (uniqueGlobalNamespace === undefined) {
  573. i = 0;
  574. do {
  575. uniqueGlobalNamespace = 'ExtBox' + (++i);
  576. } while (Ext.global[uniqueGlobalNamespace] !== undefined);
  577. Ext.global[uniqueGlobalNamespace] = Ext;
  578. this.uniqueGlobalNamespace = uniqueGlobalNamespace;
  579. }
  580. return uniqueGlobalNamespace;
  581. },
  582. <span id='Ext-property-functionFactoryCache'> /**
  583. </span> * @private
  584. */
  585. functionFactoryCache: {},
  586. cacheableFunctionFactory: function() {
  587. var me = this,
  588. args = Array.prototype.slice.call(arguments),
  589. cache = me.functionFactoryCache,
  590. idx, fn, ln;
  591. if (Ext.isSandboxed) {
  592. ln = args.length;
  593. if (ln &gt; 0) {
  594. ln--;
  595. args[ln] = 'var Ext=window.' + Ext.name + ';' + args[ln];
  596. }
  597. }
  598. idx = args.join('');
  599. fn = cache[idx];
  600. if (!fn) {
  601. fn = Function.prototype.constructor.apply(Function.prototype, args);
  602. cache[idx] = fn;
  603. }
  604. return fn;
  605. },
  606. functionFactory: function() {
  607. var me = this,
  608. args = Array.prototype.slice.call(arguments),
  609. ln;
  610. if (Ext.isSandboxed) {
  611. ln = args.length;
  612. if (ln &gt; 0) {
  613. ln--;
  614. args[ln] = 'var Ext=window.' + Ext.name + ';' + args[ln];
  615. }
  616. }
  617. return Function.prototype.constructor.apply(Function.prototype, args);
  618. },
  619. <span id='Ext-property-Logger'> /**
  620. </span> * @private
  621. * @property
  622. */
  623. Logger: {
  624. verbose: emptyFn,
  625. log: emptyFn,
  626. info: emptyFn,
  627. warn: emptyFn,
  628. error: function(message) {
  629. throw new Error(message);
  630. },
  631. deprecate: emptyFn
  632. }
  633. });
  634. <span id='Ext-method-type'> /**
  635. </span> * Old alias to {@link Ext#typeOf}
  636. * @deprecated 4.0.0 Use {@link Ext#typeOf} instead
  637. * @method
  638. * @inheritdoc Ext#typeOf
  639. */
  640. Ext.type = Ext.typeOf;
  641. }());
  642. /*
  643. * This method evaluates the given code free of any local variable. In some browsers this
  644. * will be at global scope, in others it will be in a function.
  645. * @parma {String} code The code to evaluate.
  646. * @private
  647. * @method
  648. */
  649. Ext.globalEval = Ext.global.execScript
  650. ? function(code) {
  651. execScript(code);
  652. }
  653. : function($$code) {
  654. // IMPORTANT: because we use eval we cannot place this in the above function or it
  655. // will break the compressor's ability to rename local variables...
  656. (function(){
  657. eval($$code);
  658. }());
  659. };
  660. </pre>
  661. </body>
  662. </html>