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>
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 >
You can’t perform that action at this time.
0 commit comments