Hopefully fix infinite spinner whenever there is a disconnect (pad)

This commit is contained in:
Caleb James DeLisle
2017-09-11 15:46:21 +02:00
parent 684a12ce2e
commit 7334173b4a
10 changed files with 128 additions and 43 deletions

View File

@@ -12,9 +12,10 @@ define([
'/customize/application_config.js',
'/common/cryptpad-common.js',
'/common/common-realtime.js'
'/common/common-realtime.js',
'/common/common-util.js'
], function ($, nThen, Messages, CpNfInner, SFrameChannel, Title, UI, History, File, MetadataMgr,
AppConfig, Cryptpad, CommonRealtime) {
AppConfig, Cryptpad, CommonRealtime, Util) {
// Chainpad Netflux Inner
var funcs = {};
@@ -22,12 +23,15 @@ define([
funcs.Messages = Messages;
var evRealtimeSynced = Util.mkEvent(true);
funcs.startRealtime = function (options) {
if (ctx.cpNfInner) { return ctx.cpNfInner; }
options.sframeChan = ctx.sframeChan;
options.metadataMgr = ctx.metadataMgr;
ctx.cpNfInner = CpNfInner.start(options);
ctx.cpNfInner.metadataMgr.onChangeLazy(options.onLocal);
ctx.cpNfInner.whenRealtimeSyncs(function () { evRealtimeSynced.fire(); });
return ctx.cpNfInner;
};
@@ -197,6 +201,10 @@ define([
});
}; */
funcs.gotoURL = function (url) { ctx.sframeChan.event('EV_GOTO_URL', url); };
funcs.whenRealtimeSyncs = evRealtimeSynced.reg;
Object.freeze(funcs);
return { create: function (cb) {
nThen(function (waitFor) {