tools_dj 1.0.69 → 1.0.71

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/lib/request.d.ts CHANGED
@@ -34,6 +34,7 @@ export default class {
34
34
  * @param option 请求头配置参数
35
35
  * @param conf 配置
36
36
  * @param conf.callback 成功回调
37
+ * @param conf.errBack 失败回调
37
38
  * @param conf.abController 配置中断控制
38
39
  * @param conf.timeout 超时
39
40
  * @param conf.baseUrl 前缀
package/lib/request.js CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0});const t=require("./index");exports.default=class{constructor(t={},e={}){this.options={},this.conf={baseUrl:"",timeout:6e3},this.options=t,Object.assign(this.conf,e)}serve(e="",o={},s={}){const n=(0,t.mergeObj)([this.conf,s]);const c=(0,t.mergeObj)([this.options,o],{callback:function(t){if(t)return t()},callType:"Function"}),{timeout:r=6e3,baseUrl:i}=n;e=i+e;const l=new AbortController,a=l.signal;n.abController&&n.abController(l);const b=setTimeout((()=>{l.abort()}),r);return fetch(e,Object.assign(Object.assign({},c),{signal:a})).then((t=>(clearTimeout(b),n.callback?n.callback(t):t))).catch((t=>(clearTimeout(b),t)))}};
1
+ Object.defineProperty(exports,"__esModule",{value:!0});const t=require("./index");exports.default=class{constructor(t={},e={}){this.options={},this.conf={baseUrl:"",timeout:6e3},this.options=t,Object.assign(this.conf,e)}serve(e="",o={},c={}){const s=(0,t.mergeObj)([this.conf,c]);const n=(0,t.mergeObj)([this.options,o],{callback:function(t){if(t)return t()},callType:"Function"}),{timeout:l=6e3,baseUrl:r}=s;e=r+e;const a=new AbortController,i=a.signal;s.abController&&s.abController(a);const b=setTimeout((()=>{a.abort()}),l);return fetch(e,Object.assign(Object.assign({},n),{signal:i})).then((t=>(clearTimeout(b),s.callback?s.callback(t):t))).catch((t=>{throw s.callback&&s.callback(t),clearTimeout(b),t}))}};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tools_dj",
3
- "version": "1.0.69",
3
+ "version": "1.0.71",
4
4
  "description": "dj tools 工具库",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",