File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,9 @@ export default {
6363 this .resetTimeDisplay ()
6464 },
6565 },
66+ async created () {
67+ this .notificationPermission = await Notification .requestPermission ()
68+ },
6669 mounted () {
6770 this .resetTimeDisplay ()
6871 // Start loading the sound early so it's ready to go when we need to
@@ -92,12 +95,20 @@ export default {
9295 // Start playing audio to alert the user that the timer is up
9396 this .audio .play ()
9497
95- await showSimpleAlertModal (t (" cookbook" , " Cooking time is up!" ))
98+ const message = t (" cookbook" , " Cooking time is up!" )
99+
100+ if (this .notificationPermission === " granted" ) {
101+ const notification = new Notification (message)
102+ notification .addEventListener (" error" , (error ) => {
103+ // eslint-disable-next-line no-console
104+ console .error (" Error showing notification:" , error)
105+ })
106+ }
107+
108+ await showSimpleAlertModal (message)
96109
97110 // Stop audio after the alert is confirmed
98111 this .audio .pause ()
99-
100- // cookbook.notify(t('cookbook', 'Cooking time is up!'))
101112 $this .countdown = null
102113 $this .showFullTime = false
103114 $this .resetTimeDisplay ()
You can’t perform that action at this time.
0 commit comments