@fetchx/fetcher-xhr 0.1.5 → 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 CHANGED
@@ -9,4 +9,4 @@
9
9
  1. 不是 `Promise`(这里封装了)
10
10
  2. 支持 timeout
11
11
  3. 支持 progress
12
- 4. 支持 abort,但需要得到 xhr 对象,这里用 `AbortController` 做了封装
12
+ 4. 支持 abort,但需要得到 xhr 对象,这里用 `AbortControllerShim` 做了封装
@@ -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>;\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":[]}
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.5",
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.3"
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": "1c1a9de5ccee14ee6da99d89be047138312f8518"
49
+ "gitHead": "db1d93479dac474769f0b4ccec5dded50d62f847"
50
50
  }