Move OC.EventSource to the server bundle

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2019-01-29 09:23:38 +01:00
parent 8e9d259074
commit 3695d02575
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8
6 changed files with 60 additions and 56 deletions

View File

@ -21,7 +21,6 @@
"sharedialogshareelistview.js",
"octemplate.js",
"contactsmenu_templates.js",
"eventsource.js",
"public/appconfig.js",
"public/comments.js",
"public/publicpage.js",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,6 @@
"js.js",
"l10n.js",
"octemplate.js",
"eventsource.js",
"public/appconfig.js",
"public/comments.js",
"public/whatsnew.js",

View File

@ -30,14 +30,16 @@
/* global EventSource */
import $ from 'jquery'
/**
* Create a new event source
* @param {string} src
* @param {object} [data] to be send as GET
*
* @constructs OC.EventSource
* @constructs OCEventSource
*/
OC.EventSource=function(src,data){
const OCEventSource = function (src, data) {
var dataStr = '';
var name;
var joinChar;
@ -62,8 +64,8 @@ OC.EventSource=function(src,data){
}
}.bind(this);
} else {
var iframeId='oc_eventsource_iframe_'+OC.EventSource.iframeCount;
OC.EventSource.fallBackSources[OC.EventSource.iframeCount]=this;
var iframeId = 'oc_eventsource_iframe_' + OCEventSource.iframeCount;
OCEventSource.fallBackSources[OCEventSource.iframeCount] = this;
this.iframe = $('<iframe/>');
this.iframe.attr('id', iframeId);
this.iframe.hide();
@ -72,10 +74,10 @@ OC.EventSource=function(src,data){
if (src.indexOf('?') === -1) {
joinChar = '?';
}
this.iframe.attr('src',src+joinChar+'fallback=true&fallback_id='+OC.EventSource.iframeCount+'&'+dataStr);
this.iframe.attr('src', src + joinChar + 'fallback=true&fallback_id=' + OCEventSource.iframeCount + '&' + dataStr);
$('body').append(this.iframe);
this.useFallBack = true;
OC.EventSource.iframeCount++;
OCEventSource.iframeCount++;
}
//add close listener
this.listen('__internal__', function (data) {
@ -84,12 +86,12 @@ OC.EventSource=function(src,data){
}
}.bind(this));
};
OC.EventSource.fallBackSources=[];
OC.EventSource.iframeCount=0;//number of fallback iframes
OC.EventSource.fallBackCallBack=function(id,type,data){
OC.EventSource.fallBackSources[id].fallBackCallBack(type,data);
OCEventSource.fallBackSources = [];
OCEventSource.iframeCount = 0;//number of fallback iframes
OCEventSource.fallBackCallBack = function (id, type, data) {
OCEventSource.fallBackSources[id].fallBackCallBack(type, data);
};
OC.EventSource.prototype={
OCEventSource.prototype = {
typelessListeners: [],
iframe: null,
listeners: {},//only for fallback
@ -162,3 +164,5 @@ OC.EventSource.prototype={
}
}
};
export default OCEventSource;

View File

@ -24,6 +24,7 @@ import Backbone from 'backbone';
import Apps from './apps'
import AppConfig from './appconfig'
import ContactsMenu from './contactsmenu';
import EventSource from './eventsource'
import {davCall, davSync} from './backbone-webdav';
// Patch Backbone for DAV
@ -37,5 +38,6 @@ export default {
Apps,
AppConfig,
Backbone,
EventSource,
ContactsMenu,
};