Skip to content

Commit 61dadbe

Browse files
Addded notification in clkc
1 parent 9c572ce commit 61dadbe

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

clock/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ <h2 style="margin: 1rem;">Waste</h2>
254254
minCounter = 0
255255
}
256256
minute.innerHTML = `${++minCounter} :`
257+
sendNotification(`Study ${minCounter} minute`)
257258
}, 60000)
258259
sec = setInterval(() => {
259260
if (secCounter === 60) {
@@ -371,6 +372,8 @@ <h2 style="margin: 1rem;">Waste</h2>
371372
minCounter = 0
372373
}
373374
minute.innerHTML = `${++minCounter} :`
375+
sendNotification(`Study ${minCounter} minute`)
376+
374377
}, 60000)
375378
sec = setInterval(() => {
376379
if (secCounter === 60) {
@@ -447,6 +450,7 @@ <h2 style="margin: 1rem;">Waste</h2>
447450
}
448451
timer1()
449452
timer2()
453+
getNotification()
450454
function store(key,value){
451455
window.localStorage.setItem(key,String(value));
452456
}
@@ -458,6 +462,16 @@ <h2 style="margin: 1rem;">Waste</h2>
458462
function clear(key){
459463
window.localStorage.removeItem(key)
460464
}
465+
function getNotification(){
466+
Notification.requestPermission().then(function (result) {
467+
console.log("Notification permission:", result);
468+
});
469+
}
470+
function sendNotification(body){
471+
new Notification("Timer is up!", {
472+
body: body
473+
});
474+
}
461475
</script>
462476

463477
</html>

0 commit comments

Comments
 (0)