Created
July 23, 2021 18:14
-
-
Save dotproto/418ba29bbeafb5b2a0e1665f4cd3de2a to your computer and use it in GitHub Desktop.
Manifest V3 module service worker demo
This file contains 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
// Copyright 2021 Google LLC | |
// | |
// Use of this source code is governed by a BSD-style | |
// license that can be found in the LICENSE file or at | |
// https://developers.google.com/open-source/licenses/bsd | |
// Use importScripts to load other JS files | |
import { demo } from './lib.js'; | |
console.log(demo.greeting); | |
/* | |
* Uncomment this block and reload the extension to see how errors are handled. | |
* When enabled in Canary (as of 2021-07-23), the extension's error page will | |
* contain two entries: | |
* | |
* - A warning stating "Service worker registration failed" | |
* - An error stating "Uncaught Error: Testing error handling" | |
*/ | |
// throw new Error('Testing error handling'); |
This file contains 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
// Copyright 2021 Google LLC | |
// | |
// Use of this source code is governed by a BSD-style | |
// license that can be found in the LICENSE file or at | |
// https://developers.google.com/open-source/licenses/bsd | |
export const demo = { | |
greeting: 'Hello, world!' | |
} |
This file contains 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
{ | |
"name": "Module service worker demo", | |
"version": "1.0", | |
"manifest_version": 3, | |
"background": { | |
"service_worker": "background.js", | |
"type": "module" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment