avm99963 | 3a4946d | 2021-02-05 21:27:12 +0100 | [diff] [blame] | 1 | // IMPORTANT: keep this file in sync with sw.js |
Adrià Vilanova MartÃnez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 2 | import {cleanUpOptions} from './common/optionsUtils.js' |
avm99963 | 3a4946d | 2021-02-05 21:27:12 +0100 | [diff] [blame] | 3 | |
avm99963 | 4c1a679 | 2020-08-31 21:30:42 +0200 | [diff] [blame] | 4 | // When the extension gets updated, set new options to their default value. |
avm99963 | 122dc9b | 2019-03-30 18:44:18 +0100 | [diff] [blame] | 5 | chrome.runtime.onInstalled.addListener(function(details) { |
avm99963 | b69eb3d | 2020-08-20 02:03:44 +0200 | [diff] [blame] | 6 | if (details.reason == 'install' || details.reason == 'update') { |
avm99963 | 4c1a679 | 2020-08-31 21:30:42 +0200 | [diff] [blame] | 7 | chrome.storage.sync.get(null, function(options) { |
avm99963 | bf8eece | 2021-04-22 00:27:03 +0200 | [diff] [blame] | 8 | cleanUpOptions(options, false); |
avm99963 | 4c1a679 | 2020-08-31 21:30:42 +0200 | [diff] [blame] | 9 | }); |
avm99963 | 122dc9b | 2019-03-30 18:44:18 +0100 | [diff] [blame] | 10 | } |
avm99963 | cbea314 | 2019-03-28 00:48:15 +0100 | [diff] [blame] | 11 | }); |
avm99963 | 1a1d2b7 | 2020-08-20 03:15:20 +0200 | [diff] [blame] | 12 | |
| 13 | chrome.browserAction.onClicked.addListener(function() { |
| 14 | chrome.runtime.openOptionsPage(); |
| 15 | }); |