mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 15:00:01 -04:00
15 lines
No EOL
474 B
JavaScript
15 lines
No EOL
474 B
JavaScript
importScripts("./scramjet.codecs.js");
|
|
importScripts("./scramjet.config.js");
|
|
importScripts("./scramjet.worker.js");
|
|
|
|
const scramjet = new ScramjetServiceWorker();
|
|
|
|
self.addEventListener("fetch", async (event) => {
|
|
event.respondWith((async() => {
|
|
if (event.request.url.startsWith(location.origin + __scramjet$config.prefix)) {
|
|
return await scramjet.fetch(event);
|
|
} else {
|
|
return await fetch(event.request);
|
|
}
|
|
})())
|
|
})
|