Parallelize loadSkin

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2020-04-08 19:21:39 +01:00
parent b3780445d3
commit e267086a17
1 changed files with 7 additions and 7 deletions

View File

@ -76,6 +76,11 @@ function checkBrowserFeatures() {
return featureComplete; return featureComplete;
} }
let acceptBrowser = checkBrowserFeatures();
if (!acceptBrowser && window.localStorage) {
acceptBrowser = Boolean(window.localStorage.getItem("mx_accepts_unsupported_browser"));
}
// React depends on Map & Set which we check for using modernizr's es6collections // React depends on Map & Set which we check for using modernizr's es6collections
// if modernizr fails we may not have a functional react to show the error message. // if modernizr fails we may not have a functional react to show the error message.
// try in react but fallback to an `alert` // try in react but fallback to an `alert`
@ -124,22 +129,17 @@ async function start() {
// load config requires the platform to be ready // load config requires the platform to be ready
const loadConfigPromise = loadConfig(); const loadConfigPromise = loadConfig();
await loadSkin();
let acceptBrowser = checkBrowserFeatures();
if (!acceptBrowser && window.localStorage) {
acceptBrowser = Boolean(window.localStorage.getItem("mx_accepts_unsupported_browser"));
}
// await config here // await config here
const configError = await loadConfigPromise; const configError = await loadConfigPromise;
// Load language after loading config.json so that settingsDefaults.language can be applied // Load language after loading config.json so that settingsDefaults.language can be applied
const loadLanguagePromise = loadLanguage(); const loadLanguagePromise = loadLanguage();
// as quickly as we possibly can, set a default theme... // as quickly as we possibly can, set a default theme...
const loadThemePromise = loadTheme(); const loadThemePromise = loadTheme();
const loadSkinPromise = loadSkin();
// await things starting successfully // await things starting successfully
await loadOlmPromise; await loadOlmPromise;
await settled(loadSkinPromise);
await loadThemePromise; await loadThemePromise;
await loadLanguagePromise; await loadLanguagePromise;