add api to check whether the realtime has synced with the server

This commit is contained in:
ansuz
2017-02-13 10:42:17 +01:00
parent 3b1bd2f720
commit f723585758
2 changed files with 14 additions and 14 deletions

View File

@@ -44,6 +44,18 @@ define([
return;
};
var whenRealtimeSyncs = common.whenRealtimeSyncs = function (realtime, cb) {
realtime.sync();
var interval = 300;
var check = function () {
if (realtime.getAuthDoc() !== realtime.getUserDoc()) {
return window.setTimeout(check, interval);
}
cb();
};
window.setTimeout(check, interval);
};
var getWebsocketURL = common.getWebsocketURL = function () {
if (!Config.websocketPath) { return Config.websocketURL; }
var path = Config.websocketPath;