mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-17 08:00:02 -04:00
chore: lint:fix
This commit is contained in:
parent
4d7fa7abb6
commit
e8a8a66397
5 changed files with 22 additions and 13 deletions
|
@ -47,7 +47,7 @@ export default function (client: ScramjetClient, self: Self) {
|
|||
body: ctx.args[0],
|
||||
});
|
||||
|
||||
let now = performance.now();
|
||||
const now = performance.now();
|
||||
while (view.getUint8(0) === 0) {
|
||||
if (performance.now() - now > 1000) {
|
||||
throw new Error("xhr timeout");
|
||||
|
@ -85,13 +85,15 @@ export default function (client: ScramjetClient, self: Self) {
|
|||
client.RawTrap(ctx.this, "response", {
|
||||
get() {
|
||||
if (ctx.this.responseType === "arraybuffer") return bodyab.buffer;
|
||||
return body;
|
||||
|
||||
return body;
|
||||
},
|
||||
});
|
||||
client.RawTrap(ctx.this, "responseXML", {
|
||||
get() {
|
||||
const parser = new DOMParser();
|
||||
return parser.parseFromString(body, "text/xml");
|
||||
|
||||
return parser.parseFromString(body, "text/xml");
|
||||
},
|
||||
});
|
||||
client.RawTrap(ctx.this, "getAllResponseHeaders", {
|
||||
|
@ -104,7 +106,8 @@ export default function (client: ScramjetClient, self: Self) {
|
|||
return (header: string) => {
|
||||
const re = new RegExp(`^${header}: (.*)$`, "m");
|
||||
const match = re.exec(headers);
|
||||
return match ? match[1] : null;
|
||||
|
||||
return match ? match[1] : null;
|
||||
};
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue