Browse Source

Refactor dispatchEvent from EventDispatcher, that have redondant code call. Use call method directly on listenerArray instead of copy it in temporary array. Remove useless variable initializer.

Tristan Valcke 8 years ago
parent
commit
aca0d5e1e5
1 changed files with 2 additions and 11 deletions
  1. 2 11
      src/core/EventDispatcher.js

+ 2 - 11
src/core/EventDispatcher.js

@@ -68,18 +68,9 @@ Object.assign( EventDispatcher.prototype, {
 
 			event.target = this;
 
-			var array = [], i = 0;
-			var length = listenerArray.length;
+			for ( var i = 0, length = listenerArray.length ; i < length; ++i ) {
 
-			for ( i = 0; i < length; i ++ ) {
-
-				array[ i ] = listenerArray[ i ];
-
-			}
-
-			for ( i = 0; i < length; i ++ ) {
-
-				array[ i ].call( this, event );
+				listenerArray[ i ].call( this, event );
 
 			}