subscribing to config event

part of #2462
This commit is contained in:
Miodec 2022-02-10 21:40:07 +01:00
parent 82e8edbc2f
commit b2609bb084
2 changed files with 7 additions and 7 deletions

View file

@ -1,7 +1,6 @@
import * as DB from "./db";
import * as Sound from "./controllers/sound-controller";
import * as OutOfFocus from "./test/out-of-focus";
import * as LiveBurst from "./test/live-burst";
import * as Funbox from "./test/funbox";
import * as Notifications from "./elements/notifications";
import * as ThemeController from "./controllers/theme-controller";
@ -705,11 +704,6 @@ export function setShowLiveBurst(live, nosave) {
live = false;
}
config.showLiveBurst = live;
if (live) {
LiveBurst.show();
} else {
LiveBurst.hide();
}
if (!nosave) saveToLocalStorage();
dispatchEvent("showLiveBurst", config.showLiveBurst);
}

View file

@ -1,4 +1,4 @@
import Config from "../config";
import Config, * as UpdateConfig from "../config";
import * as TestLogic from "./test-logic";
export function update(burst) {
@ -55,3 +55,9 @@ export function hide() {
}
);
}
$(document).ready(() => {
UpdateConfig.subscribeToEvent((eventKey, eventValue) => {
if (eventKey === "showLiveBurst") eventValue ? show() : hide();
});
});