@whitesev/utils 1.9.0 → 1.9.2

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
@@ -1793,6 +1793,14 @@ define((function () { 'use strict';
1793
1793
  fetch: details.fetch || this.context.#defaultDetails.fetch,
1794
1794
  /* 对象使用深拷贝 */
1795
1795
  fetchInit: utils.deepClone(this.context.#defaultDetails.fetchInit),
1796
+ allowInterceptConfig: {
1797
+ beforeRequest: this.context.#defaultDetails
1798
+ .allowInterceptConfig.beforeRequest,
1799
+ afterResponseSuccess: this.context.#defaultDetails
1800
+ .allowInterceptConfig.afterResponseSuccess,
1801
+ afterResponseError: this.context.#defaultDetails
1802
+ .allowInterceptConfig.afterResponseError,
1803
+ },
1796
1804
  user: details.user || this.context.#defaultDetails.user,
1797
1805
  password: details.password || this.context.#defaultDetails.password,
1798
1806
  onabort(...args) {
@@ -1817,6 +1825,26 @@ define((function () { 'use strict';
1817
1825
  that.context.HttpxCallBack.onLoad(details, resolve, reject, args);
1818
1826
  },
1819
1827
  };
1828
+ // 补全allowInterceptConfig参数
1829
+ if (typeof details.allowInterceptConfig === "boolean") {
1830
+ Object.keys(result.allowInterceptConfig).forEach((keyName) => {
1831
+ result.allowInterceptConfig[keyName] =
1832
+ details.allowInterceptConfig;
1833
+ });
1834
+ }
1835
+ else {
1836
+ if (typeof details.allowInterceptConfig === "object" &&
1837
+ details.allowInterceptConfig != null) {
1838
+ Object.keys(details.allowInterceptConfig).forEach((keyName) => {
1839
+ let value = details.allowInterceptConfig[keyName];
1840
+ if (keyName in
1841
+ result.allowInterceptConfig &&
1842
+ typeof value === "boolean") {
1843
+ result.allowInterceptConfig[keyName] = value;
1844
+ }
1845
+ });
1846
+ }
1847
+ }
1820
1848
  if (typeof this.context.GM_Api.xmlHttpRequest !== "function") {
1821
1849
  result.fetch = true;
1822
1850
  }