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