mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-10-18 14:13:21 +00:00
no sw caching on localhost
This commit is contained in:
parent
0a506f44a2
commit
bc92461f32
@ -46,7 +46,6 @@
|
||||
window.addEventListener('load', function() {
|
||||
navigator.serviceWorker.register('serviceworker.js')
|
||||
.then(function(registration) {
|
||||
// Registration was successful
|
||||
// console.log('ServiceWorker registration successful with scope: ', registration.scope);
|
||||
})
|
||||
.catch(function(err) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
var CACHE_NAME = 'iris-messenger-cache-v1';
|
||||
|
||||
// stale-while-revalidate caching strategy
|
||||
// stale-while-revalidate
|
||||
if (self.location.host.indexOf('localhost') !== 0) {
|
||||
self.addEventListener('fetch', function(event) {
|
||||
event.respondWith(
|
||||
caches.open(CACHE_NAME).then(function(cache) {
|
||||
@ -14,3 +15,4 @@ self.addEventListener('fetch', function(event) {
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user