-
Notifications
You must be signed in to change notification settings - Fork 0
/
background.js
65 lines (60 loc) · 2.48 KB
/
background.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
var water_alarm = chrome.alarms.create("waterAlarm", { delayInMinutes: 0.05, periodInMinutes: 45 });
var blink_alarm = chrome.alarms.create("blinkAlarm", { delayInMinutes: 0.05, periodInMinutes: 20 });
var posture_alarm = chrome.alarms.create("postureAlarm", { delayInMinutes: 0.05, periodInMinutes: 30 });
var stretch_alarm = chrome.alarms.create("stretchAlarm", { delayInMinutes: 0.05, periodInMinutes: 90 });
chrome.alarms.onAlarm.addListener( function (blink_alarm) {
if (blink_alarm.name === "blinkAlarm") {
console.log("blink Alarm");
var notification = chrome.notifications.create(
'take-a-break-notification', {
type: 'basic',
iconUrl: './assets/glasses.png',
title: 'Take a break!',
message: 'Look away from your computer screen and focus on a spot 20 feet away for 20 seconds.'
},
function () {}
);
}
});
chrome.alarms.onAlarm.addListener( function (water_alarm) {
if (water_alarm.name === "waterAlarm") {
console.log("water Alarm");
var notification = chrome.notifications.create(
'take-a-break-notification', {
type: 'basic',
iconUrl: './assets/water.png',
title: 'Stay Hydrated!',
message: 'Drink a glass of water and stay hydrated and glowing.'
},
function () {}
);
}
});
chrome.alarms.onAlarm.addListener( function (posture_alarm) {
if (posture_alarm.name === "postureAlarm") {
console.log("posture Alarm");
var notification = chrome.notifications.create(
'take-a-break-notification', {
type: 'basic',
iconUrl: './assets/posture.png',
title: 'Sit Straight!',
message: 'Maintain a straight posture. Increase you concentration and healthy life.'
},
function () {}
);
}
});
chrome.alarms.onAlarm.addListener( function (stretch_alarm) {
if (stretch_alarm.name === "stretchAlarm") {
console.log("stretch Alarm");
var notification = chrome.notifications.create(
'take-a-break-notification', {
type: 'basic',
iconUrl: './assets/stretch.png',
title: 'Stretch Yourself!',
message: 'It\'s time to drop everything you are doing. Stand up and stretch yourself for a while.'
},
function () {}
);
}
});