mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-15 07:20:02 -04:00
swruntime: implement fetch event
This commit is contained in:
parent
14a0305bdb
commit
15bc9598c9
9 changed files with 273 additions and 31 deletions
|
@ -35,6 +35,14 @@ export async function swfetch(
|
|||
});
|
||||
}
|
||||
|
||||
const activeWorker = this.serviceWorkers.find(
|
||||
(w) => w.origin === new URL(request.url).origin
|
||||
);
|
||||
if (activeWorker) {
|
||||
// TODO: check scope
|
||||
return await activeWorker.fetch(request);
|
||||
}
|
||||
|
||||
const urlParam = new URLSearchParams(new URL(request.url).search);
|
||||
|
||||
if (urlParam.has("url")) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue