From 07f4878d59a7459472e66a2ba0c1c0413232107e Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 15 Dec 2019 11:57:26 +0300 Subject: workaround for a race condition between dojo.parse() and tt-rss loading proper day/night css on startup because of firefox async CSS loader --- js/prefs.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'js/prefs.js') diff --git a/js/prefs.js b/js/prefs.js index 747eb4105..944e49258 100755 --- a/js/prefs.js +++ b/js/prefs.js @@ -63,19 +63,21 @@ require(["dojo/_base/kernel", try { const _App = declare("fox.App", AppBase, { constructor: function() { - parser.parse(); + this.setupNightModeDetection(() => { + parser.parse(); - this.setLoadingProgress(50); + this.setLoadingProgress(50); - const clientTzOffset = new Date().getTimezoneOffset() * 60; - const params = {op: "rpc", method: "sanityCheck", clientTzOffset: clientTzOffset}; + const clientTzOffset = new Date().getTimezoneOffset() * 60; + const params = {op: "rpc", method: "sanityCheck", clientTzOffset: clientTzOffset}; - xhrPost("backend.php", params, (transport) => { - try { - this.backendSanityCallback(transport); - } catch (e) { - this.Error.report(e); - } + xhrPost("backend.php", params, (transport) => { + try { + this.backendSanityCallback(transport); + } catch (e) { + this.Error.report(e); + } + }); }); }, initSecondStage: function() { -- cgit v1.2.3-54-g00ecf