Instantly share code, notes, and snippets.

Embed
What would you like to do?
/*global self: true */
'use strict';
self.addEventListener('fetch', event => {
const url = new URL(event.request.url);
if(url.pathname.endsWith('.png')
|| url.pathname.endsWith('.jpg')) {
event.respondWith(
fetch('./nickCage.jpg')
);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment