summaryrefslogtreecommitdiff
path: root/frontend/permissionrequest.js
blob: 0c8d4d9a04ca71124e745498037de43b390b7ddb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const notif = document.getElementById("notif-panel");
const notbtn = document.getElementById("notbtn");

OneSignalDeferred.push(async function(OneSignal) {
	try {

	if (OneSignal.Notifications.permission) {
		notif.remove();
		startbtn.disabled = false;
	}
	data.onesignal_subscription_id = OneSignal.User.PushSubscription["id"];
	}
	catch (e) {
		alert("onesignal error ", e, e.toString());
	}
});

console.log("notbtn")

notbtn.addEventListener("click", () => requestPermission())
async function requestPermission() {
	subscribe()
}