Skip to content

Instantly share code, notes, and snippets.

View Haqverdi's full-sized avatar
🏠
Working from home

Haqverdi Behbudov Haqverdi

🏠
Working from home
  • Azerbaijan, Baku
View GitHub Profile
@Haqverdi
Haqverdi / sw.js
Created December 21, 2018 06:54 — forked from ireade/sw.js
Handle broken images with the service worker
self.addEventListener('install', (e) => {
e.waitUntil(
caches.open("precache").then((cache) => cache.add("/broken.png"))
);
});
function isImage(fetchRequest) {
return fetchRequest.method === "GET" && fetchRequest.destination === "image";
}