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

Merge pull request #271 from ckeditor/t/ckeditor5-react/40

Other: Replaced `for..of` statement in `EventEmitter` with `Array.prototype.forEach`. This changes allows building a React application using `create-react-app@2`. Closes ckeditor/ckeditor5-react#40.
Maciej Bukowski 7 лет назад
Родитель
Сommit
c079ca03d3
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      packages/ckeditor5-utils/src/emittermixin.js

+ 4 - 2
packages/ckeditor5-utils/src/emittermixin.js

@@ -237,7 +237,9 @@ const EmitterMixin = {
 					this._delegations = new Map();
 				}
 
-				for ( const eventName of events ) {
+				// Originally there was a for..of loop which unfortunately caused an error in Babel that didn't allow
+				// build an application. See: https://github.com/ckeditor/ckeditor5-react/issues/40.
+				events.forEach( eventName => {
 					const destinations = this._delegations.get( eventName );
 
 					if ( !destinations ) {
@@ -245,7 +247,7 @@ const EmitterMixin = {
 					} else {
 						destinations.set( emitter, nameOrFunction );
 					}
-				}
+				} );
 			}
 		};
 	},