@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.amd.js CHANGED
@@ -457,7 +457,6 @@ define((function () { 'use strict';
457
457
  }
458
458
  }
459
459
 
460
- /// <reference path="./index.d.ts" />
461
460
  // @name ajaxHooker
462
461
  // @author cxxjackie
463
462
  // @version 1.4.3
@@ -1506,13 +1505,14 @@ define((function () { 'use strict';
1506
1505
  },
1507
1506
  /**
1508
1507
  * 成功的回调
1509
- * @param response
1508
+ * @param response 响应
1509
+ * @param details 请求的配置
1510
1510
  */
1511
- successResponseCallBack(response) {
1511
+ successResponseCallBack(response, details) {
1512
1512
  for (let index = 0; index < this.$config.configList.length; index++) {
1513
1513
  let item = this.$config.configList[index];
1514
1514
  if (typeof item.successFn === "function") {
1515
- if (item.successFn(response) == null) {
1515
+ if (item.successFn(response, details) == null) {
1516
1516
  return;
1517
1517
  }
1518
1518
  }
@@ -1521,7 +1521,7 @@ define((function () { 'use strict';
1521
1521
  },
1522
1522
  /**
1523
1523
  * 失败的回调
1524
- * @param response
1524
+ * @param data 配置
1525
1525
  */
1526
1526
  errorResponseCallBack(data) {
1527
1527
  for (let index = 0; index < this.$config.configList.length; index++) {
@@ -1784,6 +1784,7 @@ define((function () { 'use strict';
1784
1784
  type: "onabort",
1785
1785
  error: new TypeError("request canceled"),
1786
1786
  response: null,
1787
+ details: details,
1787
1788
  }) == null) {
1788
1789
  return;
1789
1790
  }
@@ -1815,6 +1816,7 @@ define((function () { 'use strict';
1815
1816
  type: "onerror",
1816
1817
  error: new TypeError("request error"),
1817
1818
  response: response,
1819
+ details: details,
1818
1820
  }) == null) {
1819
1821
  return;
1820
1822
  }
@@ -1843,6 +1845,7 @@ define((function () { 'use strict';
1843
1845
  type: "ontimeout",
1844
1846
  error: new TypeError("request timeout"),
1845
1847
  response: (argumentsList || [null])[0],
1848
+ details: details,
1846
1849
  }) == null) {
1847
1850
  return;
1848
1851
  }
@@ -1926,8 +1929,7 @@ define((function () { 'use strict';
1926
1929
  }
1927
1930
  /* 状态码2xx都是成功的 */
1928
1931
  if (Math.floor(Response.status / 100) === 2) {
1929
- if (this.context.HttpxResponseHook.successResponseCallBack(Response) ==
1930
- null) {
1932
+ if (this.context.HttpxResponseHook.successResponseCallBack(Response, details) == null) {
1931
1933
  return;
1932
1934
  }
1933
1935
  resolve({
@@ -2048,7 +2050,7 @@ define((function () { 'use strict';
2048
2050
  let responseText = "";
2049
2051
  /** 响应xml文档 */
2050
2052
  let responseXML = "";
2051
- let arrayBuffer = await resp.arrayBuffer;
2053
+ let arrayBuffer = await resp.arrayBuffer();
2052
2054
  let encoding = "utf-8";
2053
2055
  if (resp.headers.has("Content-Type")) {
2054
2056
  let charsetMatched = resp.headers
@@ -2059,7 +2061,7 @@ define((function () { 'use strict';
2059
2061
  }
2060
2062
  }
2061
2063
  let textDecoder = new TextDecoder(encoding);
2062
- responseText = textDecoder.decode(await resp.arrayBuffer());
2064
+ responseText = textDecoder.decode(arrayBuffer);
2063
2065
  response = responseText;
2064
2066
  if (details.responseType === "arraybuffer") {
2065
2067
  response = arrayBuffer;