Skip to content

Commit b3df3ea

Browse files
XMLHttpNodeRequest implementation
1 parent 933285a commit b3df3ea

File tree

4 files changed

+330
-20
lines changed

4 files changed

+330
-20
lines changed

package-lock.json

+22-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"homepage": "https://github.com/haveno-dex/haveno-ts#readme",
2929
"dependencies": {
3030
"@types/node": "^18.14.2",
31+
"axios": "^1.7.9",
3132
"console": "^0.7.2",
3233
"decimal.js": "^10.4.3",
3334
"google-protobuf": "^3.20.3",
@@ -37,6 +38,7 @@
3738
"@babel/core": "^7.21.0",
3839
"@babel/preset-env": "^7.20.2",
3940
"@babel/preset-typescript": "^7.21.0",
41+
"@types/axios": "^0.14.4",
4042
"@types/jest": "^29.4.0",
4143
"@typescript-eslint/eslint-plugin": "5.53.0",
4244
"@typescript-eslint/parser": "^5.53.0",

src/index.ts

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
import XMLHttpNodeRequest, { XMLHttpNodeRequestEventTarget, XMLHttpNodeRequestUpload, ProgressEvent, checkXMLHttpSupport } from "./utils/XMLHttpNodeRequest";
2+
3+
if (!checkXMLHttpSupport()) {
4+
//@ts-ignore
5+
global.ProgressEvent = ProgressEvent;
6+
//@ts-ignore
7+
global.XMLHttpRequestEventTarget = XMLHttpNodeRequestEventTarget;
8+
//@ts-ignore
9+
global.XMLHttpRequestUpload = XMLHttpNodeRequestUpload;
10+
//@ts-ignore
11+
global.XMLHttpRequest = XMLHttpNodeRequest;
12+
}
13+
114
import HavenoClient from "./HavenoClient";
215
import HavenoError from "./types/HavenoError";
316
import HavenoUtils from "./utils/HavenoUtils";

0 commit comments

Comments
 (0)