Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #271 from ckeditor/t/ckeditor5-react/40
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ma2ciek committed Jan 25, 2019
2 parents e1e097c + 3dc7156 commit 900b54b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/emittermixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,17 @@ 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 ) {
this._delegations.set( eventName, new Map( [ [ emitter, nameOrFunction ] ] ) );
} else {
destinations.set( emitter, nameOrFunction );
}
}
} );
}
};
},
Expand Down

0 comments on commit 900b54b

Please sign in to comment.