Created
July 18, 2017 23:47
-
-
Save gauntface/86d9ad679457e9a45460a2b37191b811 to your computer and use it in GitHub Desktop.
Example loading in "workbox.js"
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
| class Workbox { | |
| loadModule(moduleName) { | |
| // Load workbox module from CDN | |
| importScripts(`https://some-cdn.cdn.com/${moduleName}/build/umd.js`); | |
| } | |
| get precaching() { | |
| if (google.workbox.precaching) { | |
| return google.workbox.precaching.default; | |
| } | |
| this.loadModule('workbox-precaching'); | |
| return google.workbox.precaching.default; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment