Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Inspector = {
  2.  
  3.     classes: [],
  4.  
  5.     used: [],
  6.  
  7.     init: function(){
  8.         Inspector.iterate(Ext, 'Ext.');
  9.     },
  10.  
  11.     iterate: function(root, chain){
  12.         var I = Inspector,
  13.             prop,
  14.             first,
  15.             o;
  16.  
  17.         for (var prop in root) {
  18.             o = root[prop];
  19.             first = prop.substr(0, 1);
  20.             if (/[A-Z]/.test(first)) {
  21.                 if (Ext.isFunction(o)) {
  22.                     o.prototype.constructor = o.prototype.constructor.createInterceptor(function(){
  23.                         Ext.each(I.classes, function(detail){
  24.                             if (this instanceof detail.cls) {
  25.                                 if (I.used.indexOf(detail.name) == -1) {
  26.                                     I.used.push(detail.name);
  27.                                 }
  28.                             }
  29.                         }, this);
  30.                     });
  31.                     I.classes.push({
  32.                         cls: o,
  33.                         name: chain + prop
  34.                     });
  35.                 }
  36.             } else if (Ext.isObject(o)) {
  37.                 I.iterate(o, chain + prop + '.');
  38.             }
  39.         }
  40.     }
  41. };
  42.  
  43. Inspector.init();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement