Update sw.js

This commit is contained in:
Harsh Khandeparkar
2019-03-27 18:02:26 +00:00
committed by GitHub
parent 077d85bbb5
commit 508d1d8f71

View File

@@ -1,4 +1,12 @@
const staticCacheName = 'image-sequencer-static-v3';
const request = new XMLHttpRequest();
request.open("GET", "../manifest.json", false);
request.send(null);
const meta = JSON.parse(request.responseText).metadata,
ver = meta.version,
betaVer = meta.betaVersion;
const version = (window.location.indexOf('beta') == 0) ? betaVer : ver;
const staticCacheName = `image-sequencer-static-v${version}`;
self.addEventListener('install', event => {
console.log('Attempting to install service worker');
@@ -32,4 +40,4 @@ self.addEventListener('fetch', function(event) {
});
})
);
});
});