You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
1.0 KiB

"use strict";
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
const cancelerMap = /* @__PURE__ */ new Map();
const _RequestCancel = class {
static createInstance() {
return this.instance || (this.instance = new _RequestCancel());
}
add(url, requestTask) {
this.remove(url);
if (cancelerMap.has(url)) {
cancelerMap.delete(url);
}
cancelerMap.set(url, requestTask);
}
remove(url) {
if (cancelerMap.has(url)) {
const requestTask = cancelerMap.get(url);
requestTask && requestTask.abort();
cancelerMap.delete(url);
}
}
};
let RequestCancel = _RequestCancel;
__publicField(RequestCancel, "instance");
const requestCancel = RequestCancel.createInstance();
exports.requestCancel = requestCancel;