Nebula/public/sw.js
MotorTruck1221 3b00a749b5
Add UV
2024-08-18 00:21:03 -06:00

20 lines
611 B
JavaScript

importScripts('/epoxy/index.js');
importScripts('/uv/uv.bundle.js');
importScripts('/uv/uv.config.js');
importScripts(__uv$config.sw || '/uv/uv.sw.js');
const uv = new UVServiceWorker();
self.addEventListener('fetch', function (event) {
if (event.request.url.startsWith(location.origin + __uv$config.prefix)) {
event.respondWith(
(async function () {
return await uv.fetch(event);
})()
);
} else {
event.respondWith(
(async function () {
return await fetch(event.request);
})()
);
}
});