mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 15:00:01 -04:00
refactor: everything
This commit is contained in:
parent
78e666d314
commit
506d99f9b6
37 changed files with 925 additions and 885 deletions
20
src/client/shared/worker.ts
Normal file
20
src/client/shared/worker.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { encodeUrl } from "../../shared/rewriters/url";
|
||||
import { ScramjetClient } from "../client";
|
||||
|
||||
export default function (client: ScramjetClient, self: typeof globalThis) {
|
||||
client.Proxy("Worker", {
|
||||
construct({ args }) {
|
||||
if (args[0] instanceof URL) args[0] = args[0].href;
|
||||
if (args[0].startsWith("blob:") || args[0].startsWith("data:")) {
|
||||
// TODO
|
||||
return;
|
||||
}
|
||||
|
||||
args[0] = encodeUrl(args[0]) + "?dest=worker";
|
||||
|
||||
if (args[1] && args[1].type === "module") {
|
||||
args[0] += "&type=module";
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue