document.getElementById("startbtn").addEventListener("click", () => { start(); }); const urlParams = new URLSearchParams(window.location.search); data.machine_id = urlParams.get('machine'); console.log(urlParams); startUpdateMachines(); const notbtn = document.getElementById("notbtn") notbtn.addEventListener("click", () => requestPermission()) async function requestPermission() { console.log("Requesting permission..."); const onesig_res = await OneSignal.Notifications.requestPermission(); alert(onesig_res); } const notif = document.getElementById("notif-panel"); if (Notification.permission == 'granted') { notif.remove(); }