Last active
December 20, 2017 11:39
-
-
Save edoardocavazza/77048c0d3a7ef78296157ddbe7ad4c4a to your computer and use it in GitHub Desktop.
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
// import Unchained core and plugins. | |
importScripts( | |
'node_modules/unchained-js/lib/core.js', | |
'node_modules/unchained-js/lib/plugins/babel.js', | |
'node_modules/unchained-js/lib/plugins/resolve.js' | |
); | |
// intercept fetch events. | |
this.addEventListener('fetch', (event) => { | |
// verify if requested resource is an import. | |
if (Unchained.check(event)) { | |
event.respondWith( | |
// resolve the resource response. | |
Unchained.resolve(event) | |
); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment