-
Notifications
You must be signed in to change notification settings - Fork 0
/
background.js
29 lines (26 loc) · 880 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
chrome.runtime.onInstalled.addListener((details) => {
const currentVersion = chrome.runtime.getManifest().version
const previousVersion = details.previousVersion
const reason = details.reason
// console.log(`Previous Version: ${previousVersion }`)
// console.log(`Current Version: ${currentVersion }`)
switch (reason) {
case 'install':
console.log('New User installed the extension.')
chrome.storage.local.set({
defaultArchiveId: '1',
openBookmarkInNewTab: false,
actionOnBookmarkClicked: 'none',
defaultSort: 'oldest-first'
})
break;
case 'update':
console.log('User has updated their extension.')
break;
case 'chrome_update':
case 'shared_module_update':
default:
console.log('Other install events within the browser')
break;
}
})