File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -254,6 +254,7 @@ <h2 style="margin: 1rem;">Waste</h2>
254
254
minCounter = 0
255
255
}
256
256
minute . innerHTML = `${ ++ minCounter } :`
257
+ sendNotification ( `Study ${ minCounter } minute` )
257
258
} , 60000 )
258
259
sec = setInterval ( ( ) => {
259
260
if ( secCounter === 60 ) {
@@ -371,6 +372,8 @@ <h2 style="margin: 1rem;">Waste</h2>
371
372
minCounter = 0
372
373
}
373
374
minute . innerHTML = `${ ++ minCounter } :`
375
+ sendNotification ( `Study ${ minCounter } minute` )
376
+
374
377
} , 60000 )
375
378
sec = setInterval ( ( ) => {
376
379
if ( secCounter === 60 ) {
@@ -447,6 +450,7 @@ <h2 style="margin: 1rem;">Waste</h2>
447
450
}
448
451
timer1 ( )
449
452
timer2 ( )
453
+ getNotification ( )
450
454
function store ( key , value ) {
451
455
window . localStorage . setItem ( key , String ( value ) ) ;
452
456
}
@@ -458,6 +462,16 @@ <h2 style="margin: 1rem;">Waste</h2>
458
462
function clear ( key ) {
459
463
window . localStorage . removeItem ( key )
460
464
}
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
+ }
461
475
</ script >
462
476
463
477
</ html >
You can’t perform that action at this time.
0 commit comments