diff --git a/frontend/src/js/config.js b/frontend/src/js/config.js index fcc7e9f1a..aebc0bb23 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 LiveAcc from "./test/live-acc"; import * as LiveBurst from "./test/live-burst"; import * as Funbox from "./test/funbox"; import * as Notifications from "./elements/notifications"; @@ -697,11 +696,6 @@ export function setShowLiveAcc(live, nosave) { live = false; } config.showLiveAcc = live; - if (live) { - LiveAcc.show(); - } else { - LiveAcc.hide(); - } if (!nosave) saveToLocalStorage(); dispatchEvent("showLiveAcc", config.showLiveAcc); } @@ -714,7 +708,7 @@ export function setShowLiveBurst(live, nosave) { if (live) { LiveBurst.show(); } else { - LiveAcc.hide(); + LiveBurst.hide(); } if (!nosave) saveToLocalStorage(); dispatchEvent("showLiveBurst", config.showLiveBurst); diff --git a/frontend/src/js/test/live-acc.js b/frontend/src/js/test/live-acc.js index 7bd9e6301..9bf540248 100644 --- a/frontend/src/js/test/live-acc.js +++ b/frontend/src/js/test/live-acc.js @@ -1,4 +1,4 @@ -import Config from "../config"; +import Config, * as UpdateConfig from "../config"; import * as TestLogic from "./test-logic"; export function update(acc) { @@ -59,3 +59,9 @@ export function hide() { } ); } + +$(document).ready(() => { + UpdateConfig.subscribeToEvent((eventKey, eventValue) => { + if (eventKey === "showLiveWpm") eventValue ? show() : hide(); + }); +});