added Notification to WebUI

This commit is contained in:
2023-12-04 22:05:39 +01:00
parent a576c7b70c
commit 51b80f08a5
2 changed files with 79 additions and 16 deletions

View File

@@ -44,7 +44,7 @@ function onMessage(event) {
if(dtcArray[0] != "0")
{
notifyMe();
processDTCNotifications(dtcArray);
fillDTCTable(dtcArray);
}
console.log(dtcArray + "\n");
@@ -82,18 +82,4 @@ function do_resize(textbox) {
else textbox.rows = rows;
}
function notifyMe() {
if (!("Notification" in window)) {
alert("This browser does not support desktop notification");
} else if (Notification.permission === "granted") {
const notification = new Notification("Hi there!");
// …
} else if (Notification.permission !== "denied") {
Notification.requestPermission().then((permission) => {
if (permission === "granted") {
const notification = new Notification("Hi there!");
// …
}
});
}
}