-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground_script.js
More file actions
44 lines (37 loc) · 1000 Bytes
/
background_script.js
File metadata and controls
44 lines (37 loc) · 1000 Bytes
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
chrome.runtime.onInstalled.addListener(function() {
chrome.storage.sync.set({color: '#3aa757'}, function() {
console.log("The color is green.");
});
});
chrome.alarms.onAlarm.addListener(function(alarm){
timeIsUp()
});
mess = ''
//timer is done
function timeIsUp () {
mess = ''
// chrome.storage.local.get(['toDo'], function(result) {
// console.log(result.toDo);
// mess = result.toDo;
// })
chrome.storage.local.get(['toDo'], function(result) {
console.log(result.toDo);
mess = result.toDo;
chrome.notifications.create({
type: "basic",
iconUrl: 'img/Yo!.png',
title: 'YO - TIME IS UP',
message: mess
});
});
console.log('yo')
};
//background listener for time on active tab
chrome.tabs.onActivated.addListener(function(){
console.log('ping');
setTimeout(yoClock, 600000);
});
function yoClock(){
console.log('yo clock is running')
chrome.tabs.create({})
}