feat: proxy eventsource

This commit is contained in:
Percs 2024-10-11 16:36:46 -05:00
parent f8888828a9
commit 018aefb021

View file

@ -0,0 +1,16 @@
import { decodeUrl, encodeUrl } from "../../../shared";
import { ScramjetClient } from "../../client";
export default function (client: ScramjetClient) {
client.Proxy("EventSource", {
construct(ctx) {
ctx.args[0] = encodeUrl(ctx.args[0], client.meta);
},
});
client.Trap("EventSource.prototype.url", {
get(ctx) {
decodeUrl(ctx.get() as string);
},
});
}