Skip to content

Commit

Permalink
fix event trigger when callbacks are addded/removed
Browse files Browse the repository at this point in the history
  • Loading branch information
bahaa-aidi committed Sep 6, 2016
1 parent 6fe5c18 commit f02fea0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/utils/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ var Stream = function() {
if (!callbacks) {
return;
}
// Copy handlers so if handlers are added/removed during the process it
// doesn't throw everything off.
callbacks = callbacks.slice(0);
// Slicing the arguments on every invocation of this method
// can add a significant amount of overhead. Avoid the
// intermediate object creation for the common case of a
Expand Down

0 comments on commit f02fea0

Please sign in to comment.