File tree 1 file changed +16
-5
lines changed
1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -143,13 +143,24 @@ if (!keys) {
143
143
144
144
// Mix `Events` to object instance or Class function.
145
145
Events . mixTo = function ( receiver ) {
146
- receiver = isFunction ( receiver ) ? receiver . prototype : receiver
147
146
var proto = Events . prototype
148
147
149
- var event = new Events
150
- for ( var key in proto ) {
151
- if ( proto . hasOwnProperty ( key ) ) {
152
- copyProto ( key )
148
+ if ( isFunction ( receiver ) ) {
149
+ for ( var key in proto ) {
150
+ if ( proto . hasOwnProperty ( key ) ) {
151
+ receiver . prototype [ key ] = proto [ key ]
152
+ }
153
+ }
154
+ Object . keys ( proto ) . forEach ( function ( key ) {
155
+ receiver . prototype [ key ] = proto [ key ]
156
+ } )
157
+ }
158
+ else {
159
+ var event = new Events
160
+ for ( var key in proto ) {
161
+ if ( proto . hasOwnProperty ( key ) ) {
162
+ copyProto ( key )
163
+ }
153
164
}
154
165
}
155
166
You can’t perform that action at this time.
0 commit comments