-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Closed
Description
The issue I'm encountering is best illustrated with the following example:
var foo = new THREE.EventDispatcher();
foo.addEventListener("eventA", function(){
console.log('eventA listener 1');
foo.dispatchEvent({type :'eventB', data : {}});
});
foo.addEventListener("eventA", function(){
console.log('eventA listener 2');
});
foo.addEventListener("eventB", function(){
console.log('eventB listener 1');
});
foo.addEventListener("eventB", function(){
console.log('eventB listener 2');
});
foo.dispatchEvent({type : 'eventA', data : {}});
On three.js r62+ the following is output to the console:
eventA listener 1
eventB listener 1
eventB listener 2
On three.js r54 (on jsfiddle) the following is output:
eventA listener 1
eventB listener 1
eventB listener 2
eventA listener 2
Patching EventDispatcher like so results in the intended behaviour where both handlers for both events are invoked:
@@ -6731,9 +6731,9 @@ THREE.EventDispatcher.prototype = {
dispatchEvent: function () {
- var array = [];
return function ( event ) {
+ var array = [];
if ( this._listeners === undefined ) return;
Again thanks for the great library
-Mo
Metadata
Metadata
Assignees
Labels
No labels