Advertisement
fruffl

fluent interface naming conventions

Mar 25th, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.36 KB | None | 0 0
  1. // collect
  2.  
  3.     _fetch: function(element, ownerName)
  4.     {
  5.         var t = this,
  6.             m = $.tri4m.widget.hook.uuid.cache.__dict,
  7.             s = $.tri4m.widget.hook.uuid.cache.__mapping,
  8.             _t = {},
  9.             _f = function(el, n)
  10.             {
  11.                 _t[n] = {};
  12.                 s = $.extend(true, s, _t);
  13.                
  14.                 $(el).children().each(function(e)
  15.                 {
  16.                     var u = $(this), id = $(this).attr('id');
  17.                    
  18.                     if(!('undefined' !== typeof id
  19.                     &&       'uuid-' === id.substr(0x00, 0x05)))
  20.                     {
  21.                         _f(u, n);
  22.                         return;
  23.                     }
  24.                    
  25.                     var rn = $.tri4m.util.str.uuidFromId(id);
  26.                    
  27.                         m[rn] = '#' + id;
  28.                     _t[n][rn] = u;
  29.                    
  30.                     s = $.extend(true, s, _t);
  31.                    
  32.                     _f(u, (rn || id));
  33.                 });
  34.             };
  35.        
  36.         this._log('uuid._fetch');
  37.         _f(element, ownerName);
  38.     },
  39.  
  40.  
  41. // wie es gedacht war:
  42. $.extend($.tri4m.widget.hook.app.proto, {
  43.     _create : function()
  44.     {
  45.         this._persist.before.create();
  46.         this._log('app._create');
  47.         this._superApply(arguments);
  48.         this._persist.after.create();
  49.     }
  50. });
  51.  
  52.  
  53. // im proto:
  54.  
  55.     _create: function()
  56.     {
  57.         var t = this,
  58.             m = $.tri4m.widget.hook.uuid.cache.__dict,
  59.             s = $.tri4m.widget.hook.uuid.cache.__mapping,
  60.             x = $.tri4m.widget.hook.uuid.cache.__class,
  61.             n = this.widgetName,
  62.             e = this.element;
  63.         ...
  64.  
  65.         this._persist.before.create.children();
  66.         this._persist.wrap.create.children();
  67.        
  68.         for(var i in s[n])
  69.         {
  70.             ...
  71.  
  72.             this._persist.before.create.child(i, d);
  73.            
  74.             typeof d.data(i) === 'undefined'
  75.                 ? $.tri4m[i](typeof this.options.__defaults[i] === 'undefined' ? {} : this.options.__defaults[i], m[i])
  76.                 : this._log('already initialized', 0x04, m[i]);
  77.            
  78.             this._persist.after.create.child(i, d);
  79.         }
  80.  
  81.         this._persist.wrap.create.children();
  82.         this._persist.after.create.children();
  83.     },
  84.  
  85. // im proto penetrations test:
  86.  
  87.     _penetrate: function()
  88.     {
  89.         var t = this,
  90.             m = $.tri4m.widget.hook.uuid.cache.__dict,
  91.             s = $.tri4m.widget.hook.uuid.cache.__mapping,
  92.             x = $.tri4m.widget.hook.uuid.cache.__class,
  93.             n = this.widgetName,
  94.             e = this.element;
  95.         ...
  96.  
  97.         this._persist.before.penetrate.children();
  98.         this._persist.wrap.penetrate.children();
  99.        
  100.         for(var i in s[n])
  101.         {
  102.             ...
  103.  
  104.             this._persist.before.penetrate.child(i, d);
  105.            
  106.             ...
  107.            
  108.             this._persist.after.penetrate.child(i, d);
  109.         }
  110.  
  111.         this._persist.wrap.penetrate.children();
  112.         this._persist.after.penetrate.children();
  113.     },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement