@jecloud/utils
Version:
JECloud 工具库
1 lines • 621 B
JavaScript
import n from"axios";import{isFunction as e}from"../lodash";var o=new Map;export var getPendingUrl=function(n){return[n.method,n.url].join("&")};var t=function(){function t(){}return t.prototype.addPending=function(e){this.removePending(e);var t=getPendingUrl(e);e.cancelToken=e.cancelToken||new n.CancelToken((function(n){o.has(t)||o.set(t,n)}))},t.prototype.removeAllPending=function(){o.forEach((function(n){n&&e(n)&&n()})),o.clear()},t.prototype.removePending=function(n){var e=getPendingUrl(n);if(o.has(e)){var t=o.get(e);t&&t(e),o.delete(e)}},t.prototype.reset=function(){o=new Map},t}();export{t as AxiosCanceler};