blob: e2a8a2785d49e239ac4a42ce46b926e08e0d1265 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
const btn = document.getElementById("notbtn")
btn.addEventListener("click", () => requestPermission())
function requestPermission() {
console.log("Requesting permission...");
Notification.requestPermission().then((permission) => {
if (permission === "granted") {
console.log("Notification permission granted.");
}
});
}
if ("serviceWorker" in navigator) {
navigator.serviceWorker
.register("OneSignalSDKWorker.js")
.then((reg) => console.log("SW registered:", reg))
.catch((err) => console.error("SW failed:", err));
}
document.cookie = "session_key=0"
const data = {
duration: 2,
block: 1,
machine: 2,
}
fetch("http://localhost:8000/start", {
credentials: "include",
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(data)
});
|