Advertisement
keysle

3lvl K8r Object Template

Oct 25th, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Can be found on http://keysle.thoughts.com in "Talk and Progress #1.2"
  3. I'll make a video about this later and explain why I'm using this structure @yt/keysle
  4. */
  5. function __(_){return _.constructor}
  6.  
  7. //class
  8. var _ = ( CLASS = function(){
  9.     this.variable = 0;
  10.     this.sub = new CLASS.SUBCLASS();
  11. }).prototype;
  12.  
  13. _.func = function(){
  14.     alert('lvl'+this.variable);
  15.     this.sub.func();
  16. }
  17.  
  18. _.divePeak = function(){
  19.     alert('lvl'+this.variable);
  20.     this.sub.variable += 5;
  21. }
  22.  
  23.  
  24.  
  25.  
  26.  
  27.         //sub class
  28.         _ = ( __(_).SUBCLASS = function(){
  29.             this.variable = 1;
  30.             this.sub = new CLASS.SUBCLASS.DEEPCLASS();
  31.         }).prototype;
  32.  
  33.         _.func = function(){
  34.             alert('lvl'+this.variable);
  35.             this.sub.func();
  36.         }
  37.  
  38.  
  39.  
  40.  
  41.  
  42.                 //deep class
  43.                 _ = ( __(_).DEEPCLASS = function(){
  44.                     this.variable = 2;
  45.                 }).prototype;
  46.  
  47.                 _.func = function(){
  48.                     alert('lvl'+this.variable);
  49.                 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement