-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
36 lines (33 loc) · 1.16 KB
/
main.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
/**
* @file Main background script, delegates to message handlers
*/
import submitTime from './handlers/submit.js';
import getCurrentStatus from './handlers/get_current_status.js';
import updateNotes from './handlers/update_notes.js';
import {clockIn, clockOut} from './handlers/clock_in_out.js';
import getJobs from './handlers/get_jobs.js';
import setIconStatus from './handlers/set_icon_status.js';
import getTodaysNotes from './handlers/get_todays_notes.js';
chrome.runtime.onMessage.addListener((...params) => {
if (params[0].getNow)
getCurrentStatus(...params);
else if (params[0].getTodaysNotes)
getTodaysNotes(...params);
else if (params[0].getTimesheet)
submitTime(...params);
else if (params[0].updateNotes)
updateNotes(...params);
else if (params[0].clockIn)
clockIn(...params);
else if (params[0].clockOut)
clockOut(...params);
else if (params[0].getJobs)
getJobs(...params);
else if (params[0].setIcon) {
setIconStatus(...params);
}
return true;
})
chrome.browserAction.setBadgeBackgroundColor({color:'#000'})
setIconStatus();
setInterval(setIconStatus, 5*60*1000);