mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 06:50:01 -04:00
feat: proxy eventsource
This commit is contained in:
parent
f8888828a9
commit
018aefb021
1 changed files with 16 additions and 0 deletions
16
src/client/shared/requests/eventsource.ts
Normal file
16
src/client/shared/requests/eventsource.ts
Normal 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);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue