Skip to content

Commit

Permalink
On broadcast loop over a copied array of channels
Browse files Browse the repository at this point in the history
  • Loading branch information
ziogaschr committed Jul 21, 2015
1 parent 0c2d2f2 commit b1332c9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion radio.js
Expand Up @@ -68,7 +68,8 @@
* radio('channel2').broadcast(param1, param2, param3 ... );
*/
broadcast: function() {
var i, c = this.channels[this.channelName],
// use slice() so as to loop on a copy of channels list as it might be changed while looping
var i, c = this.channels[this.channelName].slice(),
l = c.length,
subscriber, callback, context;
//iterate through current channel and run each subscriber
Expand Down
2 changes: 1 addition & 1 deletion radio.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b1332c9

Please sign in to comment.