1
I’m having a problem with my service-worker. Suddenly it started showing this error in devtools:
Uncaught (in promise) DOMException: Quota exceeded.
Follows my service-worker.js:
{% load static from staticfiles %}
if( 'function' === typeof importScripts) {
importScripts("{% static 'js/cache-polyfill.js' %}");
self.addEventListener('install', function(e) {
e.waitUntil(
caches.open('myweb').then(function(cache) {
return cache.addAll([
"/",
"{% static 'assets/css/all.css' %}",
"{% static 'assets/js/all.js' %}",
]);
})
);
});
self.addEventListener('push', function(event) {
var body_content = JSON.parse(event.data.text());
const title = body_content.title;
const options = {
body: body_content.text,
icon: body_content.icon,
badge: body_content.icon,
data: {
url: body_content.url
}
};
event.waitUntil(self.registration.showNotification(title, options));
});
self.addEventListener('notificationclick', function(event) {
event.notification.close();
event.waitUntil(
clients.openWindow(event.notification.data.url)
);
});
self.addEventListener('fetch', function(event) {
event.respondWith(
caches.open('myweb').then(function(cache) {
return fetch(event.request).then(function(response) {
cache.put(event.request, response.clone());
return response;
});
})
);
});
}