mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-17 16:10:02 -04:00
16 lines
382 B
TypeScript
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);
|
|
},
|
|
});
|
|
}
|