let settled accept multiple proms + i18n

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2020-04-08 20:12:05 +01:00
parent 2837c41ca4
commit f6ad5bf54c
2 changed files with 14 additions and 13 deletions

View File

@ -1,11 +1,12 @@
{ {
"Unexpected error preparing the app. See console for details.": "Unexpected error preparing the app. See console for details.",
"Your Riot is misconfigured": "Your Riot is misconfigured",
"Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.": "Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.",
"Invalid configuration: no default server specified.": "Invalid configuration: no default server specified.",
"Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.": "Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.", "Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.": "Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.",
"The message from the parser is: %(message)s": "The message from the parser is: %(message)s", "The message from the parser is: %(message)s": "The message from the parser is: %(message)s",
"Invalid JSON": "Invalid JSON", "Invalid JSON": "Invalid JSON",
"Your Riot is misconfigured": "Your Riot is misconfigured", "Unable to load config file: please refresh the page to try again.": "Unable to load config file: please refresh the page to try again.",
"Unexpected error preparing the app. See console for details.": "Unexpected error preparing the app. See console for details.",
"Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.": "Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.",
"Invalid configuration: no default server specified.": "Invalid configuration: no default server specified.",
"Open user settings": "Open user settings", "Open user settings": "Open user settings",
"Riot Desktop on %(platformName)s": "Riot Desktop on %(platformName)s", "Riot Desktop on %(platformName)s": "Riot Desktop on %(platformName)s",
"Go to your browser to complete Sign In": "Go to your browser to complete Sign In", "Go to your browser to complete Sign In": "Go to your browser to complete Sign In",

View File

@ -33,12 +33,14 @@ if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('sw.js'); navigator.serviceWorker.register('sw.js');
} }
async function settled(prom: Promise<any>) { async function settled(...promises: Array<Promise<any>>) {
for (const prom of promises) {
try { try {
await prom; await prom;
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }
}
} }
function checkBrowserFeatures() { function checkBrowserFeatures() {
@ -141,9 +143,7 @@ async function start() {
const loadSkinPromise = loadSkin(); const loadSkinPromise = loadSkin();
// await things settling so that any errors we have to render have features like i18n running // await things settling so that any errors we have to render have features like i18n running
await settled(loadSkinPromise); await settled(loadSkinPromise, loadThemePromise, loadLanguagePromise);
await settled(loadThemePromise);
await settled(loadLanguagePromise);
// ########################## // ##########################
// error handling begins here // error handling begins here
@ -173,7 +173,7 @@ async function start() {
// await things starting successfully // await things starting successfully
// ################################## // ##################################
await loadOlmPromise; await loadOlmPromise;
await settled(loadSkinPromise); await loadSkinPromise;
await loadThemePromise; await loadThemePromise;
await loadLanguagePromise; await loadLanguagePromise;