Browse Source

EventDispatcher: Create array only if listenerArray is defined.

Mr.doob 11 years ago
parent
commit
d07e623ac2
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/core/EventDispatcher.js

+ 2 - 2
src/core/EventDispatcher.js

@@ -79,13 +79,13 @@ THREE.EventDispatcher.prototype = {
 		if ( this._listeners === undefined ) return;
 
 		var listeners = this._listeners;
-		var listenerArray = listeners[ event.type ];			
-		var array = [];
+		var listenerArray = listeners[ event.type ];
 
 		if ( listenerArray !== undefined ) {
 
 			event.target = this;
 
+			var array = [];
 			var length = listenerArray.length;
 
 			for ( var i = 0; i < length; i ++ ) {