diff options
author | Miodec <[email protected]> | 2024-12-22 00:28:50 +0100 |
---|---|---|
committer | Miodec <[email protected]> | 2024-12-22 00:40:54 +0100 |
commit | baaea33490e889c987844771de64a1fa9202e097 (patch) | |
tree | 4913fcf2c8253fe8fe8692d841fd1bd5129e7705 | |
parent | a670438bb98931ed7f62780293f8eb5dddfddd07 (diff) | |
download | monkeytype-baaea33490e889c987844771de64a1fa9202e097.tar.gz monkeytype-baaea33490e889c987844771de64a1fa9202e097.zip |
refactor: ready function now awaits config to be loaded to avoid concurrency issues
-rw-r--r-- | frontend/src/ts/ready.ts | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/frontend/src/ts/ready.ts b/frontend/src/ts/ready.ts index e1b923688..695c82478 100644 --- a/frontend/src/ts/ready.ts +++ b/frontend/src/ts/ready.ts @@ -8,8 +8,10 @@ import * as AccountButton from "./elements/account-button"; import Konami from "konami"; import * as ServerConfiguration from "./ape/server-configuration"; import { getActiveFunboxes } from "./test/funbox/list"; +import { loadPromise } from "./config"; -$((): void => { +$(async (): Promise<void> => { + await loadPromise; Misc.loadCSS("/css/slimselect.min.css", true); Misc.loadCSS("/css/balloon.min.css", true); @@ -19,11 +21,10 @@ $((): void => { //to make sure the initial theme application doesnt animate the background color $("body").css("transition", "background .25s, transform .05s"); MerchBanner.showIfNotClosedBefore(); - setTimeout(() => { - for (const fb of getActiveFunboxes()) { - fb.functions?.applyGlobalCSS?.(); - } - }, 500); //this approach will probably bite me in the ass at some point + + for (const fb of getActiveFunboxes()) { + fb.functions?.applyGlobalCSS?.(); + } $("#app") .css("opacity", "0") |