forked from Stigmatoz/web-activity-time-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.ts
More file actions
33 lines (27 loc) · 973 Bytes
/
background.ts
File metadata and controls
33 lines (27 loc) · 973 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
import Browser from 'webextension-polyfill';
import { initTracker } from './tracker';
import { logger } from './compositions/logger';
import { scheduleJobs } from './jobs/sheduler';
import { Settings } from './compositions/settings';
import { StorageParams } from './storage/storage-params';
logger.log('Start background script');
Browser.runtime.onInstalled.addListener(details => {
logger.log('Extension installed:', details);
});
Browser.storage.onChanged.addListener((changes, namespace) => {
for (var key in changes) {
if (Object.values(StorageParams).includes(key as StorageParams))
Settings.getInstance().reloadSetting(key as StorageParams);
}
});
Browser.runtime.onInstalled.addListener(details => {
if (
details.reason == 'update' &&
details.previousVersion != undefined &&
details.previousVersion < '2.0.0'
) {
}
});
Browser.runtime.setUninstallURL('https://webtracker.online/goodbye.html');
scheduleJobs();
initTracker();