-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackground.js
30 lines (28 loc) · 982 Bytes
/
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
chrome.alarms.onAlarm.addListener((a) => {
chrome.notifications.create(String(Date.now()), {
type: 'basic',
title: "Lespass Checking In!",
message: "Time's up for your task!",
priority: 2,
iconUrl: ".\\unknown.png",
eventTime: Date.now()
})
})
chrome.tabs.onUpdated.addListener(
function(details){
chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs => {
let url = tabs[0].url;
chrome.storage.local.get("urls", (result)=>{
if (result["urls"].includes(url)){
chrome.storage.local.get("page", (page)=> {
// console.log(page)
if((page['page'] === "lespass") || (page['page'] === "urls")) {
chrome.tabs.update({url: './back_to_work.html'});
}
});
}
}
)
})
}
)