From b2609bb084fed1309c9cf264891d26a78588f807 Mon Sep 17 00:00:00 2001 From: Miodec Date: Thu, 10 Feb 2022 21:40:07 +0100 Subject: [PATCH] subscribing to config event part of #2462 --- frontend/src/js/config.js | 6 ------ frontend/src/js/test/live-burst.js | 8 +++++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/src/js/config.js b/frontend/src/js/config.js index aebc0bb23..74dd108ee 100644 --- a/frontend/src/js/config.js +++ b/frontend/src/js/config.js @@ -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); } diff --git a/frontend/src/js/test/live-burst.js b/frontend/src/js/test/live-burst.js index ab64a2704..636e2ed58 100644 --- a/frontend/src/js/test/live-burst.js +++ b/frontend/src/js/test/live-burst.js @@ -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(); + }); +});