cyp/app/js/app.js

38 lines
735 B
JavaScript
Raw Normal View History

2019-03-22 22:35:04 +08:00
import * as nav from "./nav.js";
import * as mpd from "./lib/mpd.js";
2019-03-21 17:32:58 +08:00
import * as player from "./player.js";
2019-03-22 22:35:04 +08:00
import * as queue from "./queue.js";
const components = { queue };
export function activate(what) {
for (let id in components) {
let node = document.querySelector(`#${id}`);
if (what == id) {
node.style.display = "";
components[id].activate();
} else {
node.style.display = "none";
}
}
nav.active(what);
}
2019-03-20 03:45:23 +08:00
async function init() {
2019-03-22 22:35:04 +08:00
nav.init(document.querySelector("nav"));
for (let id in components) {
let node = document.querySelector(`#${id}`);
components[id].init(node);
}
2019-03-20 03:45:23 +08:00
await mpd.init();
2019-03-22 22:35:04 +08:00
player.init(document.querySelector("#player"));
activate("queue");
2019-03-20 03:45:23 +08:00
window.mpd = mpd;
}
2019-03-22 22:35:04 +08:00
2019-03-20 03:45:23 +08:00
init();