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 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
| importScripts('https://some-cdn.cdn.com/workbox/workbox.js'); | |
| const workbox = new Workbox(); | |
| workbox.precaching.precache([ | |
| {url: '/', revision: '123'}, | |
| {url: '/main.css', revision: '456'}, | |
| ]); |
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 { | |
| constructor(options) { | |
| console.log('[WorkboxLoader.constructor]', options.packagesPath); | |
| this._packagesPath = options.packagesPath; | |
| // This is required | |
| this.loadModule('workbox-core'); | |
| } | |
| loadModule(moduleName) { |
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
| if ('vibrate' in Notification.prototype) { | |
| // Vibrate property is supported. | |
| } else { | |
| // Vibrate property is NOT supported. | |
| } |
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
| console.group('%cHello World', 'color: #3498db'); | |
| console.groupEnd(); |
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
| console.group('My Custom Heading'); | |
| console.log('Message 1'); | |
| console.log('Message 2'); | |
| console.groupEnd(); |
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
| console.groupCollapsed(); | |
| console.log('Message 1'); | |
| console.log('Message 2'); | |
| console.groupCollapsed(); | |
| console.log('Message 3'); | |
| console.log('Message 4'); |
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
| console.group(); | |
| console.log('Message 1'); | |
| console.log('Message 2'); | |
| console.group(); | |
| console.log('Message 3'); | |
| console.log('Message 4'); |
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
| console.log('%cHello World', 'color: #3498db'); |
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
| console.log('%cHello %cWorld', 'color: #3498db', 'color: #1abc9c; font-weight: bold; font-size: 1.4em;'); |