Skip to content

Commit

Permalink
fix: broken demo sw
Browse files Browse the repository at this point in the history
  • Loading branch information
Percslol committed Dec 30, 2024
1 parent 58d1c01 commit e9035a1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions static/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@ importScripts(

const scramjet = new ScramjetServiceWorker();

self.addEventListener("fetch", async (event) => {
async function handleRequest(event) {
await scramjet.loadConfig();
if (scramjet.route(event)) {
event.respondWith(scramjet.fetch(event));
return scramjet.fetch(event);
}

return fetch(event.request);
}

self.addEventListener("fetch", (event) => {
event.respondWith(handleRequest(event));
});

let playgroundData;
Expand Down

0 comments on commit e9035a1

Please sign in to comment.