We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f114b2c commit 7006a1fCopy full SHA for 7006a1f
packages/mesh-common/src/utils/file.ts
@@ -1,6 +1,11 @@
1
-export function getFile(url: string) {
2
- var Httpreq = new XMLHttpRequest();
3
- Httpreq.open("GET", url, false);
4
- Httpreq.send(null);
5
- return Httpreq.responseText;
+export async function getFile(url: string) {
+ if (typeof XMLHttpRequest !== "undefined") {
+ var Httpreq = new XMLHttpRequest();
+ Httpreq.open("GET", url, false);
+ Httpreq.send(null);
6
+ return Httpreq.responseText;
7
+ } else {
8
+ const res = await fetch(url);
9
+ return res.text();
10
+ }
11
}
0 commit comments