dispatching configApplied event

removes dependency
fixes 2 circular dependencies
part of #2462
This commit is contained in:
Miodec 2022-02-11 16:55:10 +01:00
parent fe38315f24
commit c55d3318f4
3 changed files with 9 additions and 2 deletions

View file

@ -1455,6 +1455,8 @@ export function apply(configObj) {
$("#ad_about1").remove();
$("#ad_about2").remove();
}
ConfigEvent.dispatch("configApplied", config);
}
}

View file

@ -12,6 +12,7 @@ import * as PresetController from "../controllers/preset-controller";
import * as ThemePicker from "../settings/theme-picker";
import * as ImportExportSettingsPopup from "../popups/import-export-settings-popup";
import * as CustomThemePopup from "../popups/custom-theme-popup";
import * as ConfigEvent from "./../observables/config-event";
import Page from "./page";
export let groups = {};
@ -915,6 +916,12 @@ $(".quickNav .links a").on("click", (e) => {
isOpen && toggleSettingsGroup(settingsGroup);
});
$(document).ready(() => {
ConfigEvent.subscribe((eventKey) => {
if (eventKey === "configApplied") update();
});
});
export const page = new Page(
"settings",
$(".page.pageSettings"),

View file

@ -1,5 +1,4 @@
import * as UpdateConfig from "../config";
import * as Settings from "../pages/settings";
import * as Notifications from "../elements/notifications";
export function show(mode, config) {
@ -37,7 +36,6 @@ function hide() {
);
}
UpdateConfig.saveToLocalStorage();
Settings.update();
}
$("#settingsImportWrapper")
.stop(true, true)