Просмотр исходного кода

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 9 лет назад
Родитель
Сommit
aca0d5e1e5
1 измененных файлов с 2 добавлено и 11 удалено
  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 );
 
 			}
 

粤ICP备19079148号