imba-uni-request
Version:
uniapp框架封装的请求包 imba-uni-request
1 lines • 1.95 kB
JavaScript
var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,a(n.key),n)}}function i(t,e,r){return e&&o(t.prototype,e),r&&o(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function u(t,e,r){return(e=a(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function a(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==r(e)?e:e+""}t.d(e,{l:()=>c});var s=function(){return i((function t(e){n(this,t),u(this,"taskProList",[]),this.taskType=e}),[{key:"use",value:function(t,e){var r=Math.random().toString(36).slice(2),n=this.taskType;return e||(e=function(t){return Promise.reject(t)}),this.taskProList.push({id:r,type:n,resolved:t,rejected:e}),r}},{key:"call",value:function(t){this.taskProList.forEach((function(e){return e&&t(e)}))}},{key:"abort",value:function(t){return this.eject(t)}},{key:"eject",value:function(t){var e=this.taskProList.findIndex((function(e){return e.id===t})),r=-1!==e;return r&&this.taskProList.splice(1,e),r}}])}(),c=i((function t(){n(this,t),u(this,"request",new s("request")),u(this,"response",new s("response"))})),f=e.l;export{f as Interceptors};