Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #30 from cptbtptpbcptdtptp/fix/loadImg
Browse files Browse the repository at this point in the history
Fix load Image Fail.
  • Loading branch information
cptbtptpbcptdtptp authored Sep 26, 2024
2 parents b4f982a + 0b8ba3e commit 2ac134e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/XMLHttpRequest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import EventTarget from "./EventTarget";
import { atob } from "./atob";
import { Blob } from "./blob";

declare let my: any;
const _requestHeader = new Map();
Expand Down Expand Up @@ -172,6 +173,9 @@ export class XMLHttpRequest extends EventTarget {
throw "InvalidStateError : responseType is " + this._responseType;
}
});
if (responseType === "blob") {
this.response = new Blob([<ArrayBuffer>this.response], { type: "image/png" });
}
} else {
this.responseText = data;
}
Expand Down Expand Up @@ -219,7 +223,7 @@ export class XMLHttpRequest extends EventTarget {
method: this._method,
timeout: this.timeout,
headers: header,
dataType: responseType,
dataType: responseType === "blob" ? "arraybuffer" : responseType,
success: onSuccess,
fail: onFail,
...XMLHttpRequest._requestParams
Expand Down

0 comments on commit 2ac134e

Please sign in to comment.