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

Commit

Permalink
Observable: make a copy of observers otherwise if there are many obse…
Browse files Browse the repository at this point in the history
…rveOnce ones they are not correctly applied.
  • Loading branch information
cdujeu committed Nov 27, 2015
1 parent cbaedc3 commit 7cb5725
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/src/plugins/gui.ajax/res/js/es6/lang/Observable.es6
Expand Up @@ -45,8 +45,9 @@ class Observable {
this._objectEventSetup(event_name);
var collected_return_values = [];
var args = Array.from(arguments).slice(1);
for(var i = 0; i < this._observers[event_name].length; ++i){
collected_return_values.push(this._observers[event_name][i].apply(this._observers[event_name][i],args) || null);
var observersCopy = this._observers[event_name].slice(0);
for(var i = 0; i < observersCopy.length; ++i){
collected_return_values.push(observersCopy[i].apply(observersCopy[i],args) || null);
}
return collected_return_values;
}
Expand Down

0 comments on commit 7cb5725

Please sign in to comment.