fix potential problem when using multiply eventsource's
This commit is contained in:
parent
71b70bb05f
commit
ad495a9218
1 changed files with 7 additions and 3 deletions
|
@ -33,8 +33,12 @@
|
||||||
*/
|
*/
|
||||||
OC.EventSource=function(src,data){
|
OC.EventSource=function(src,data){
|
||||||
var dataStr='';
|
var dataStr='';
|
||||||
for(name in data){
|
this.typelessListeners=[];
|
||||||
dataStr+=name+'='+encodeURIComponent(data[name])+'&';
|
this.listeners={};
|
||||||
|
if(data){
|
||||||
|
for(name in data){
|
||||||
|
dataStr+=name+'='+encodeURIComponent(data[name])+'&';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(!this.useFallBack && typeof EventSource !='undefined'){
|
if(!this.useFallBack && typeof EventSource !='undefined'){
|
||||||
this.source=new EventSource(src+'?'+dataStr);
|
this.source=new EventSource(src+'?'+dataStr);
|
||||||
|
@ -42,7 +46,7 @@ OC.EventSource=function(src,data){
|
||||||
for(var i=0;i<this.typelessListeners.length;i++){
|
for(var i=0;i<this.typelessListeners.length;i++){
|
||||||
this.typelessListeners[i](JSON.parse(e.data));
|
this.typelessListeners[i](JSON.parse(e.data));
|
||||||
}
|
}
|
||||||
}
|
}.bind(this);
|
||||||
}else{
|
}else{
|
||||||
iframeId='oc_eventsource_iframe_'+OC.EventSource.iframeCount;
|
iframeId='oc_eventsource_iframe_'+OC.EventSource.iframeCount;
|
||||||
OC.EventSource.fallBackSources[OC.EventSource.iframeCount]=this;
|
OC.EventSource.fallBackSources[OC.EventSource.iframeCount]=this;
|
||||||
|
|
Loading…
Reference in a new issue