Debian Codegraph @

pkg/playground/notifications-receiver.js

raw
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 import { page_status } from "notifications";
3
4 function id(sel) {
5 return document.getElementById(sel);
6 }
7
8 function update() {
9 const status = page_status.get("playground");
10
11 if (status) {
12 id("received-type").innerText = status.type;
13 id("received-title").innerText = status.title;
14 } else if (status !== undefined) {
15 id("received-type").innerText = "-";
16 id("received-title").innerText = "-";
17 }
18 }
19
20 function init () {
21 page_status.addEventListener("changed", update);
22 update();
23 }
24
25 document.addEventListener("DOMContentLoaded", init);