Skip to content

Commit

Permalink
Forced data update when extension is updated
Browse files Browse the repository at this point in the history
  • Loading branch information
modos189 committed Oct 2, 2020
1 parent 624fd74 commit 5d8f81e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scripts/updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
let progress_interval_id = null;
let update_timeout_id = null;
let external_update_timeout_id = null;
checkUpdates().then();
checkExternalUpdates().then();
runExtension().then()

browser.runtime.onMessage.addListener(function(request) {
switch (request.type) {
Expand All @@ -25,6 +24,15 @@ browser.runtime.onMessage.addListener(function(request) {
}
});

async function runExtension() {
let version = browser.runtime.getManifest().version;
let last_version = await browser.storage.local.get('lastversion');
if (!last_version || last_version !== version) {
await checkUpdates(true);
await checkExternalUpdates(true);
}
}

async function save(options) {
const data = {};
Object.keys(options).forEach(key => {
Expand Down

0 comments on commit 5d8f81e

Please sign in to comment.