-
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
159787b
commit ad38f19
Showing
14 changed files
with
43,623 additions
and
41,266 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
// @ts-nocheck | ||
/*global UVServiceWorker,__uv$config*/ | ||
/* | ||
* Stock service worker script. | ||
* Users can provide their own sw.js if they need to extend the functionality of the service worker. | ||
* Ideally, this will be registered under the scope in uv.config.js so it will not need to be modified. | ||
* However, if a user changes the location of uv.bundle.js/uv.config.js or sw.js is not relative to them, they will need to modify this script locally. | ||
*/ | ||
|
||
importScripts('/uv/uv.sw.js'); | ||
|
||
importScripts(`uv.config.js`); | ||
|
||
const params = new URL(self.location.href).searchParams | ||
const serverURL = atob(params.get('url')); | ||
const sw = new UVServiceWorker(serverURL); | ||
self.__uv$config.bare = `${serverURL}/bare/` | ||
|
||
importScripts('uv.bundle.js'); | ||
importScripts(__uv$config.sw || 'uv.sw.js'); | ||
|
||
const sw = new UVServiceWorker(); | ||
|
||
self.addEventListener('fetch', event => event.respondWith(sw.fetch(event))); | ||
self.addEventListener('fetch', (event) => event.respondWith(sw.fetch(event))); |
Oops, something went wrong.