Skip to content

Instantly share code, notes, and snippets.

@luke-denton-aligent
Last active November 16, 2016 04:02
Show Gist options
  • Save luke-denton-aligent/2d0f00e76151d9e4bf412df8eb1bf354 to your computer and use it in GitHub Desktop.
Save luke-denton-aligent/2d0f00e76151d9e4bf412df8eb1bf354 to your computer and use it in GitHub Desktop.
This snippet shows how to create a new request to another resource
// Offline Web Applications course on Udacity https://classroom.udacity.com/courses/ud899
fetch('/imgs/superman.jpg'); //Returns a Response object
//Example of it in use
//Using https://gist.github.com/luke-denton/4f2e9caf3ee95b84c692871f070d75df
self.addEventListener('fetch', function(event) {
event.respondWith(
//Any request made will receive a superman jpg as a response
fetch('/imgs/superman.jpg');
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment