@fetchx/fetcher-xhr 0.1.6 → 0.1.7
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 +1 -1
- package/dist/esm/types/index.js.map +1 -1
- package/dist/types/types/index.d.ts +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/types/index.ts"],"sourcesContent":["export interface IXhrOptions {\n method?: string;\n timeout?: number;\n signal?: AbortSignal | null;\n withCredentials?: boolean; // default true\n headers?: HeadersInit | Record<string, string | number | boolean
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/types/index.ts"],"sourcesContent":["export interface IXhrOptions {\n method?: string;\n timeout?: number;\n signal?: AbortSignal | null;\n withCredentials?: boolean; // default true\n headers?: HeadersInit | Record<string, string | number | boolean> | null;\n body?: XMLHttpRequestBodyInit | null;\n onProgress?(progress: number): void; // progress 范围 [0, 1]\n}\n\n/**\n * 模仿 `Response` 对象,注意 `fetch` 的 `Response` 对象还包含以下额外属性(这里不加)\n *\n * - body: ReadableStream;\n * - bodyUsed: boolean;\n * - redirected: boolean;\n * - statusText: string;\n * - type: string; // basic\n */\nexport interface IXhrResponse<T = unknown> {\n ok: boolean; // 跟 status 有关,对应 status 在 200-299 范围内,所以 status 和 statusText 就直接忽略了\n status: number;\n url: string;\n headers: Headers;\n json(): Promise<T>;\n text(): Promise<string>;\n blob(): Promise<null>;\n arrayBuffer(): Promise<null>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@ export interface IXhrOptions {
|
|
|
3
3
|
timeout?: number;
|
|
4
4
|
signal?: AbortSignal | null;
|
|
5
5
|
withCredentials?: boolean;
|
|
6
|
-
headers?: HeadersInit | Record<string, string | number | boolean
|
|
6
|
+
headers?: HeadersInit | Record<string, string | number | boolean> | null;
|
|
7
7
|
body?: XMLHttpRequestBodyInit | null;
|
|
8
8
|
onProgress?(progress: number): void;
|
|
9
9
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fetchx/fetcher-xhr",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "An xhr wrapping to mimic similar behavior of fetch.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@babel/runtime": ">=7.0.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@fetchx/fetcher-helper": "^0.1.
|
|
38
|
+
"@fetchx/fetcher-helper": "^0.1.5"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build:clean": "rimraf dist",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"watch": "pnpm build:esm -w",
|
|
47
47
|
"prepublishOnly": "pnpm build:clean && pnpm build"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "db1d93479dac474769f0b4ccec5dded50d62f847"
|
|
50
50
|
}
|