Skip to content

Commit

Permalink
src/EventEmitter.js: simplify event listener firing
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-onsip committed Jul 17, 2014
1 parent f1275e9 commit 91517eb
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/EventEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,9 @@ EventEmitter.prototype = {

// Fire event listeners
var args = Array.prototype.slice.call(arguments, 1);
this.events[event].map(function (listener) {
return function () {
listener.listener.apply(this, args);
}.bind(listener.bindTarget || this);
}, this).forEach(function (boundListener) {
this.events[event].slice().forEach(function (listener) {
try {
boundListener();
listener.listener.apply(listener.bindTarget || this, args);
} catch(err) {
this.logger.error(err.stack);
}
Expand Down

0 comments on commit 91517eb

Please sign in to comment.