fast-vue3-ui
Version:
<h1 align="center"> fast-ui </h1>
34 lines (33 loc) • 734 B
JavaScript
import i from "axios";
import { isFunction as l } from "../utils/is/index.mjs";
import a from "qs";
let n = /* @__PURE__ */ new Map();
const o = (t) => [t.method, t.url, a.stringify(t.data), a.stringify(t.params)].join("&");
class c {
addPending(e) {
this.removePending(e);
const r = o(e);
e.cancelToken = e.cancelToken || new i.CancelToken((s) => {
n.has(r) || n.set(r, s);
});
}
removePending(e) {
const r = o(e);
if (n.has(r)) {
const s = n.get(r);
s && s(), n.delete(r);
}
}
removeAllPending() {
n.forEach((e) => {
e && l(e) && e();
}), n.clear();
}
reset() {
n = /* @__PURE__ */ new Map();
}
}
export {
c as AxiosCanceler,
o as getPendingUrl
};