Last active
November 16, 2016 04:02
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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