scramjet/src/client/shared/requests/eventsource.ts
2024-10-12 15:00:03 -04:00

16 lines
382 B
TypeScript

import { unrewriteUrl, rewriteUrl } from "../../../shared";
import { ScramjetClient } from "../../client";
export default function (client: ScramjetClient) {
client.Proxy("EventSource", {
construct(ctx) {
ctx.args[0] = rewriteUrl(ctx.args[0], client.meta);
},
});
client.Trap("EventSource.prototype.url", {
get(ctx) {
unrewriteUrl(ctx.get() as string);
},
});
}