@gjsify/xmlhttprequest 0.4.43 → 0.4.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# @gjsify/xmlhttprequest
|
|
2
|
+
|
|
3
|
+
XMLHttpRequest API for GJS backed by Soup 3.0 and GLib. Supports all `responseType` values (`arraybuffer`, `blob`, `json`, `text`), `file://` URLs (read directly via GLib), root-relative URL rewriting, and `URL.createObjectURL`/`revokeObjectURL` via temp files. Used as the asset loader backing for Excalibur.js on GJS.
|
|
4
|
+
|
|
5
|
+
Part of the [gjsify](https://github.com/gjsify/gjsify) project — Node.js and Web APIs for GJS (GNOME JavaScript).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
gjsify install @gjsify/xmlhttprequest
|
|
11
|
+
|
|
12
|
+
# npm or yarn also work (e.g. adding it to an existing project):
|
|
13
|
+
npm install @gjsify/xmlhttprequest
|
|
14
|
+
yarn add @gjsify/xmlhttprequest
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { XMLHttpRequest } from '@gjsify/xmlhttprequest';
|
|
21
|
+
|
|
22
|
+
const xhr = new XMLHttpRequest();
|
|
23
|
+
xhr.responseType = 'json';
|
|
24
|
+
xhr.open('GET', 'https://api.example.com/data.json');
|
|
25
|
+
xhr.onload = () => {
|
|
26
|
+
console.log(xhr.response); // parsed JSON object
|
|
27
|
+
};
|
|
28
|
+
xhr.onerror = (e) => console.error('XHR error', e);
|
|
29
|
+
xhr.send();
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## License
|
|
33
|
+
|
|
34
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/xmlhttprequest",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.44",
|
|
4
4
|
"description": "XMLHttpRequest and URL.createObjectURL/revokeObjectURL for GJS — backed by @gjsify/fetch and GLib",
|
|
5
5
|
"module": "lib/esm/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"@girs/gio-2.0": "2.88.0-4.0.4",
|
|
43
43
|
"@girs/gjs": "4.0.4",
|
|
44
44
|
"@girs/glib-2.0": "2.88.0-4.0.4",
|
|
45
|
-
"@gjsify/fetch": "^0.4.
|
|
45
|
+
"@gjsify/fetch": "^0.4.44"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@gjsify/cli": "^0.4.
|
|
48
|
+
"@gjsify/cli": "^0.4.44",
|
|
49
49
|
"@types/node": "^25.9.1",
|
|
50
50
|
"typescript": "^6.0.3"
|
|
51
51
|
},
|