From e1e53b8cbe87484087b83002f9cc6c851169ef6b Mon Sep 17 00:00:00 2001 From: Linus Miller Date: Sun, 14 Aug 2016 19:24:22 +0200 Subject: [PATCH] Set time and message in document.title. And updated notification text and image. --- src/components/Timer/index.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/Timer/index.js b/src/components/Timer/index.js index d6f61f9..d5b0ffd 100644 --- a/src/components/Timer/index.js +++ b/src/components/Timer/index.js @@ -1,6 +1,8 @@ import markoWidgets from 'marko-widgets' import template from './template.marko' +import timeFilter from '../../util/time-filter' + const length = 25 * 60 * 1000 export default markoWidgets.defineComponent({ @@ -43,6 +45,8 @@ export default markoWidgets.defineComponent({ time = 0 } + document.title = timeFilter(time).slice(0, 5) + this.setState({ time }) @@ -54,12 +58,14 @@ export default markoWidgets.defineComponent({ endTime: new Date() } + document.title = 'Pling!' + if (Notification.permission !== 'granted') Notification.requestPermission() else { - const notification = new Notification('Notification title', { - icon: 'http://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png', - body: 'Pomdoro is done!', + const notification = new Notification('Pomodoro complete!', { + icon: 'https://www.planetnatural.com/wp-content/uploads/2014/03/tomato-supplies.jpg', + body: 'Time for a break!', }) }