diff options
| author | altaf-creator <dev@altafcreator.com> | 2025-12-01 18:17:03 +0700 |
|---|---|---|
| committer | altaf-creator <dev@altafcreator.com> | 2025-12-01 18:17:03 +0700 |
| commit | 22e159690e534b4355878aaa24e7d46a52f6abc7 (patch) | |
| tree | 3a8ac2fea716f75d9195aa58b363d6a43044fe75 /frontend | |
| parent | 076791c52fc87b430e2bd0d36e5ef6fa11d6a782 (diff) | |
onesignal actually works now
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> |
