mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Simplify Emitter.inject() a bit, as we only need to handle _events in the first injection scope.
This commit is contained in:
parent
a39eea64e9
commit
bfd3a91df0
1 changed files with 35 additions and 37 deletions
|
@ -114,10 +114,10 @@ var Emitter = {
|
||||||
statics: {
|
statics: {
|
||||||
// Override inject() so that sub-classes automatically add the accessors
|
// Override inject() so that sub-classes automatically add the accessors
|
||||||
// for the event handler functions (e.g. #onMouseDown) for each property
|
// for the event handler functions (e.g. #onMouseDown) for each property
|
||||||
inject: function inject(/* src, ... */) {
|
// NOTE: This needs to be defined in the first injection scope, as for
|
||||||
for (var i = 0, l = arguments.length; i < l; i++) {
|
// simplicity, we don't loop through all of them here.
|
||||||
var src = arguments[i],
|
inject: function inject(src) {
|
||||||
events = src._events;
|
var events = src._events;
|
||||||
if (events) {
|
if (events) {
|
||||||
// events can either be an object literal or an array of
|
// events can either be an object literal or an array of
|
||||||
// strings describing the on*-names.
|
// strings describing the on*-names.
|
||||||
|
@ -149,9 +149,7 @@ var Emitter = {
|
||||||
});
|
});
|
||||||
src._eventTypes = types;
|
src._eventTypes = types;
|
||||||
}
|
}
|
||||||
inject.base.call(this, src);
|
return inject.base.apply(this, arguments);
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue