Set time and message in document.title. And updated notification text and image.
This commit is contained in:
parent
256842e42d
commit
e1e53b8cbe
@ -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!',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user