diff options
Diffstat (limited to 'frontend')
| -rw-r--r-- | frontend/start.js | 20 | ||||
| -rw-r--r-- | frontend/start/index.html | 2 |
2 files changed, 14 insertions, 8 deletions
diff --git a/frontend/start.js b/frontend/start.js index 5c9fc5d..374c68d 100644 --- a/frontend/start.js +++ b/frontend/start.js @@ -1,4 +1,8 @@ -document.getElementById("startbtn").addEventListener("click", () => { +const notif = document.getElementById("notif-panel"); +const notbtn = document.getElementById("notbtn"); +const startbtn = document.getElementById("startbtn"); + +startbtn.addEventListener("click", () => { start(); }); @@ -8,8 +12,13 @@ console.log(urlParams); startUpdateMachines(); -const notbtn = document.getElementById("notbtn"); -const startbtn = document.getElementById("startbtn"); +OneSignalDeferred.push(async function(OneSignal) { + if (OneSignal.Notifications.permission) { + notif.remove(); + startbtn.disabled = false; + } +}); + notbtn.addEventListener("click", () => requestPermission()) async function requestPermission() { console.log("Requesting permission..."); @@ -19,8 +28,3 @@ async function requestPermission() { startbtn.disabled = false; } } -const notif = document.getElementById("notif-panel"); -if (OneSignal.Notifications.permission) { - notif.remove(); - startbtn.disabled = false; -} diff --git a/frontend/start/index.html b/frontend/start/index.html index 0f8a0cf..ec3f976 100644 --- a/frontend/start/index.html +++ b/frontend/start/index.html @@ -16,6 +16,8 @@ }, }); }); + + </script> </head> <body> |
