use stock SW, run on /uv/ scope
This commit is contained in:
parent
f06bcbaf98
commit
66520e1565
3 changed files with 3 additions and 10 deletions
|
|
@ -7,7 +7,7 @@ async function registerSW() {
|
|||
if (!navigator.serviceWorker)
|
||||
throw new Error("Your browser doesn't support service workers.");
|
||||
|
||||
await navigator.serviceWorker.register("./sw.js", {
|
||||
await navigator.serviceWorker.register(__uv$config.sw, {
|
||||
scope: __uv$config.prefix,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
importScripts("./uv/uv.bundle.js");
|
||||
importScripts("./uv/uv.config.js");
|
||||
importScripts("./uv/uv.sw.js");
|
||||
|
||||
const sw = new UVServiceWorker();
|
||||
|
||||
self.addEventListener("fetch", (event) => event.respondWith(sw.fetch(event)));
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
// This file overwrites the stock UV config.js
|
||||
|
||||
self.__uv$config = {
|
||||
prefix: "/service/",
|
||||
prefix: "/uv/service/",
|
||||
bare: "/bare/",
|
||||
encodeUrl: Ultraviolet.codec.xor.encode,
|
||||
decodeUrl: Ultraviolet.codec.xor.decode,
|
||||
handler: "/uv/uv.handler.js",
|
||||
bundle: "/uv/uv.bundle.js",
|
||||
config: "/uv/uv.config.js",
|
||||
sw: "/uv/uv.sw.js",
|
||||
sw: "/uv/sw.js",
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue