aboutsummaryrefslogtreecommitdiffstats
path: root/static/dashboard.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/dashboard.js')
-rw-r--r--static/dashboard.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/static/dashboard.js b/static/dashboard.js
index 1f89da8..828d36b 100644
--- a/static/dashboard.js
+++ b/static/dashboard.js
@@ -262,10 +262,15 @@ export default {
w.rssi == null ? 0 : 2 * (w.rssi + 100)); // -100 dBm empty, -50 full
});
- if (on.has("music")) import("./modules/music.js").then(({ default: music }) => {
+ if (on.has("music")) import("./modules/music.js").then(({ default: music, pickGame }) => {
const el = $(".dash-music");
music.mount(el);
- poll("music", music.interval ?? 2, (st) => music.update(st, el));
+ // The card shows a running game (PC or Xbox) instead of the music.
+ const last = { music: {}, games: null, xbox: null };
+ const draw = () => music.update(last.music, el, pickGame(last.games, last.xbox));
+ poll("music", music.interval ?? 2, (st) => { last.music = st; draw(); });
+ if (on.has("games")) poll("games", 5, (st) => { last.games = st; draw(); });
+ if (on.has("xbox")) poll("xbox", 30, (st) => { last.xbox = st; draw(); });
});
// The running row: a chip per module, created now in RUNNING order and