From 6f162dcf90a6aa671eb351dc25cb01e2d9cbd3cb Mon Sep 17 00:00:00 2001 From: TrueKuehli Date: Mon, 1 Oct 2018 18:10:37 +0200 Subject: A lot of changes I shoud have written a better commit, I know! --- .../NodeJSServer/src/modules/ui/notification-banner.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'WebInterface/NodeJSServer/src/modules/ui/notification-banner.js') diff --git a/WebInterface/NodeJSServer/src/modules/ui/notification-banner.js b/WebInterface/NodeJSServer/src/modules/ui/notification-banner.js index 12461fa..7e6b8cb 100644 --- a/WebInterface/NodeJSServer/src/modules/ui/notification-banner.js +++ b/WebInterface/NodeJSServer/src/modules/ui/notification-banner.js @@ -10,6 +10,7 @@ export default class BannerController { * @param {string} notificationBadge ID of badge (# of notifications) */ constructor(bannerId, textP, dismissBtn, notificationBadge) { + this.ids = {bannerId, textP, dismissBtn, notificationBadge}; this.banner = document.getElementById(bannerId); this.bannerText = document.getElementById(textP); this.dismissBtn = document.getElementById(dismissBtn); @@ -29,6 +30,21 @@ export default class BannerController { }); } + /** + * Reloads the object + */ + refresh() { + this.banner = document.getElementById(this.ids.bannerId); + this.bannerText = document.getElementById(this.ids.textP); + this.dismissBtn = document.getElementById(this.ids.dismissBtn); + this.notificationBadge = document.getElementById( + this.ids.notificationBadge); + this.bannerMsgs = []; + + // Hide Banner after JS loading finished + this.banner.classList.add('hidden'); + } + /** * Pushes a new message to the notification banner and shows it * @param {string} name Name to register notification (referenced in hide) -- cgit v1.2.3-54-g00ecf