subscribing to config event

fixes 1 circular dependency
part of #2462
This commit is contained in:
Miodec 2022-02-10 22:39:27 +01:00
parent c6cce3196c
commit 9ea6377ff2
3 changed files with 7 additions and 2 deletions

View file

@ -6,7 +6,6 @@ import * as LanguagePicker from "./settings/language-picker";
import * as BackgroundFilter from "./elements/custom-background-filter";
import LayoutList from "./test/layouts";
import * as TTS from "./test/tts";
import * as MobileTestConfig from "./popups/mobile-test-config-popup.js";
import * as TestConfig from "./test/test-config.js";
import * as PractiseWords from "./test/practise-words";
@ -211,7 +210,6 @@ export function setMode(mode, nosave) {
}
}
TestConfig.update(previous, config.mode);
MobileTestConfig.update();
PractiseWords.resetBefore();
if (!nosave) saveToLocalStorage();
dispatchEvent("mode", config.mode);

View file

@ -21,6 +21,7 @@ import "./ready";
import "./pages/about";
import "./popups/pb-tables-popup";
import "./elements/scroll-to-top";
import "./popups/mobile-test-config-popup";
import * as TestStats from "./test/test-stats";
import * as Replay from "./test/replay";
import * as TestTimer from "./test/test-timer";

View file

@ -161,3 +161,9 @@ $("#mobileTestConfigPopup .button").click((e) => {
// hidePopup();
update();
});
$(document).ready(() => {
UpdateConfig.subscribeToEvent((eventKey) => {
if (eventKey === "mode") update();
});
});