@@ -2,7 +2,7 @@ define([], function () {
22 var Utils = { } ;
33
44 Utils . Extend = function ( ChildClass , SuperClass ) {
5- var __hasProp = { } . hasOwnProperty
5+ var __hasProp = { } . hasOwnProperty ;
66
77 function BaseConstructor ( ) {
88 this . constructor = ChildClass ;
@@ -29,7 +29,7 @@ define([], function () {
2929 for ( var methodName in proto ) {
3030 var m = proto [ methodName ] ;
3131
32- if ( typeof m !== " function" ) {
32+ if ( typeof m !== ' function' ) {
3333 continue ;
3434 }
3535
@@ -68,38 +68,39 @@ define([], function () {
6868 DecoratedClass . prototype = new ctr ( ) ;
6969
7070 for ( var m = 0 ; m < superMethods . length ; m ++ ) {
71- var methodName = superMethods [ m ] ;
71+ var superMethod = superMethods [ m ] ;
7272
73- DecoratedClass . prototype [ methodName ] = SuperClass . prototype [ methodName ] ;
73+ DecoratedClass . prototype [ superMethod ] =
74+ SuperClass . prototype [ methodName ] ;
7475 }
7576
76- for ( var m = 0 ; m < decoratedMethods . length ; m ++ ) {
77- var methodName = decoratedMethods [ m ] ;
77+ var calledMethod = function ( methodName ) {
78+ // Stub out the original method if it's not decorating an actual method
79+ var originalMethod = function ( ) { } ;
7880
79- function calledMethod ( methodName ) {
80- // Stub out the original method if it's not decorating an actual method
81- var originalMethod = function ( ) { } ;
81+ if ( methodName in DecoratedClass . prototype ) {
82+ originalMethod = DecoratedClass . prototype [ methodName ] ;
83+ }
8284
83- if ( methodName in DecoratedClass . prototype ) {
84- originalMethod = DecoratedClass . prototype [ methodName ] ;
85- }
85+ var decoratedMethod = DecoratorClass . prototype [ methodName ] ;
8686
87- var decoratedMethod = DecoratorClass . prototype [ methodName ] ;
87+ return function ( ) {
88+ var unshift = Array . prototype . unshift ;
8889
89- return function ( ) {
90- var unshift = Array . prototype . unshift ;
90+ unshift . call ( arguments , originalMethod ) ;
9191
92- unshift . call ( arguments , originalMethod ) ;
92+ return decoratedMethod . apply ( this , arguments ) ;
93+ } ;
94+ } ;
9395
94- return decoratedMethod . apply ( this , arguments ) ;
95- }
96- }
96+ for ( var d = 0 ; d < decoratedMethods . length ; d ++ ) {
97+ var decoratedMethod = decoratedMethods [ d ] ;
9798
98- DecoratedClass . prototype [ methodName ] = calledMethod ( methodName ) ;
99+ DecoratedClass . prototype [ decoratedMethod ] = calledMethod ( decoratedMethod ) ;
99100 }
100101
101102 return DecoratedClass ;
102- }
103+ } ;
103104
104105 var Observable = function ( ) {
105106 this . listeners = { } ;
@@ -120,8 +121,8 @@ define([], function () {
120121 this . invoke ( this . listeners [ event ] , slice . call ( arguments , 1 ) ) ;
121122 }
122123
123- if ( "*" in this . listeners ) {
124- this . invoke ( this . listeners [ "*" ] , arguments ) ;
124+ if ( '*' in this . listeners ) {
125+ this . invoke ( this . listeners [ '*' ] , arguments ) ;
125126 }
126127 } ;
127128
0 commit comments