Skip to content

Instantly share code, notes, and snippets.

@samdbeckham
Created July 19, 2016 11:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samdbeckham/24bb10c44c5bde99753889a809dfeb49 to your computer and use it in GitHub Desktop.
Save samdbeckham/24bb10c44c5bde99753889a809dfeb49 to your computer and use it in GitHub Desktop.
/*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