@whitesev/utils 1.5.4 → 1.5.6

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/dist/index.umd.js CHANGED
@@ -461,7 +461,6 @@
461
461
  }
462
462
  }
463
463
 
464
- /// <reference path="./index.d.ts" />
465
464
  // @name ajaxHooker
466
465
  // @author cxxjackie
467
466
  // @version 1.4.3
@@ -1510,13 +1509,14 @@
1510
1509
  },
1511
1510
  /**
1512
1511
  * 成功的回调
1513
- * @param response
1512
+ * @param response 响应
1513
+ * @param details 请求的配置
1514
1514
  */
1515
- successResponseCallBack(response) {
1515
+ successResponseCallBack(response, details) {
1516
1516
  for (let index = 0; index < this.$config.configList.length; index++) {
1517
1517
  let item = this.$config.configList[index];
1518
1518
  if (typeof item.successFn === "function") {
1519
- if (item.successFn(response) == null) {
1519
+ if (item.successFn(response, details) == null) {
1520
1520
  return;
1521
1521
  }
1522
1522
  }
@@ -1525,7 +1525,7 @@
1525
1525
  },
1526
1526
  /**
1527
1527
  * 失败的回调
1528
- * @param response
1528
+ * @param data 配置
1529
1529
  */
1530
1530
  errorResponseCallBack(data) {
1531
1531
  for (let index = 0; index < this.$config.configList.length; index++) {
@@ -1788,6 +1788,7 @@
1788
1788
  type: "onabort",
1789
1789
  error: new TypeError("request canceled"),
1790
1790
  response: null,
1791
+ details: details,
1791
1792
  }) == null) {
1792
1793
  return;
1793
1794
  }
@@ -1819,6 +1820,7 @@
1819
1820
  type: "onerror",
1820
1821
  error: new TypeError("request error"),
1821
1822
  response: response,
1823
+ details: details,
1822
1824
  }) == null) {
1823
1825
  return;
1824
1826
  }
@@ -1847,6 +1849,7 @@
1847
1849
  type: "ontimeout",
1848
1850
  error: new TypeError("request timeout"),
1849
1851
  response: (argumentsList || [null])[0],
1852
+ details: details,
1850
1853
  }) == null) {
1851
1854
  return;
1852
1855
  }
@@ -1930,8 +1933,7 @@
1930
1933
  }
1931
1934
  /* 状态码2xx都是成功的 */
1932
1935
  if (Math.floor(Response.status / 100) === 2) {
1933
- if (this.context.HttpxResponseHook.successResponseCallBack(Response) ==
1934
- null) {
1936
+ if (this.context.HttpxResponseHook.successResponseCallBack(Response, details) == null) {
1935
1937
  return;
1936
1938
  }
1937
1939
  resolve({
@@ -2052,7 +2054,7 @@
2052
2054
  let responseText = "";
2053
2055
  /** 响应xml文档 */
2054
2056
  let responseXML = "";
2055
- let arrayBuffer = await resp.arrayBuffer;
2057
+ let arrayBuffer = await resp.arrayBuffer();
2056
2058
  let encoding = "utf-8";
2057
2059
  if (resp.headers.has("Content-Type")) {
2058
2060
  let charsetMatched = resp.headers
@@ -2063,7 +2065,7 @@
2063
2065
  }
2064
2066
  }
2065
2067
  let textDecoder = new TextDecoder(encoding);
2066
- responseText = textDecoder.decode(await resp.arrayBuffer());
2068
+ responseText = textDecoder.decode(arrayBuffer);
2067
2069
  response = responseText;
2068
2070
  if (details.responseType === "arraybuffer") {
2069
2071
  response = arrayBuffer;