diff options
| author | altaf-creator <dev@altafcreator.com> | 2025-12-01 18:06:09 +0700 |
|---|---|---|
| committer | altaf-creator <dev@altafcreator.com> | 2025-12-01 18:06:09 +0700 |
| commit | 076791c52fc87b430e2bd0d36e5ef6fa11d6a782 (patch) | |
| tree | 53d4147d607980509844fa2792ff160bfe453135 /frontend/start.js | |
| parent | 182720dc2e9bcdc780194307629157efbb9d8578 (diff) | |
yay it works. changes to notification permission request
Diffstat (limited to 'frontend/start.js')
| -rw-r--r-- | frontend/start.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/frontend/start.js b/frontend/start.js index 21c5a6d..5c9fc5d 100644 --- a/frontend/start.js +++ b/frontend/start.js @@ -8,14 +8,19 @@ console.log(urlParams); startUpdateMachines(); -const notbtn = document.getElementById("notbtn") +const notbtn = document.getElementById("notbtn"); +const startbtn = document.getElementById("startbtn"); notbtn.addEventListener("click", () => requestPermission()) async function requestPermission() { console.log("Requesting permission..."); - const onesig_res = await OneSignal.Notifications.requestPermission(); - alert(onesig_res); + const onesignal_result = await OneSignal.Notifications.requestPermission(); + if (onesignal_result) { + notif.remove(); + startbtn.disabled = false; + } } const notif = document.getElementById("notif-panel"); -if (Notification.permission == 'granted') { +if (OneSignal.Notifications.permission) { notif.remove(); + startbtn.disabled = false; } |
