refactor: move test restarting to the config event observer

This commit is contained in:
Miodec 2023-11-06 13:30:19 +00:00
parent 5ce886677b
commit e1b8424070
2 changed files with 3 additions and 2 deletions

View file

@ -1,5 +1,4 @@
import * as UpdateConfig from "../../config";
import * as TestLogic from "../../test/test-logic";
import { capitalizeFirstLetterOfEachWord } from "../../utils/misc";
const subgroup: MonkeyTypes.CommandsSubgroup = {
@ -31,7 +30,6 @@ function update(languages: string[]): void {
configValue: language,
exec: (): void => {
UpdateConfig.setLanguage(language);
TestLogic.restart();
},
});
});

View file

@ -1519,6 +1519,9 @@ $("header").on("click", "nav #startTestButton, #logo", () => {
ConfigEvent.subscribe((eventKey, eventValue, nosave) => {
if (ActivePage.get() === "test") {
if (eventKey === "language") {
restart();
}
if (eventKey === "difficulty" && !nosave) restart();
if (eventKey === "showAllLines" && !nosave) restart();
if (eventKey === "tapeMode" && !nosave) restart();