Files
NapCatQQ/.pnpm-store/v3/files/91/f7709299e1627c1f5a584a32bcc078fef6fb1695f4dbce2e22acf8692d683a20fc21d0a561146b8164a40dfa2686dcbac2a9c8490a6e241a48757eb3c0653d
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

21 lines
639 B
Plaintext

// The source (has been changed) is https://github.com/facebook/react/issues/5465#issuecomment-157888325
var CANCELATION_MESSAGE = {
type: 'cancelation',
msg: 'operation is manually canceled'
};
function makeCancelable(promise) {
var hasCanceled_ = false;
var wrappedPromise = new Promise(function (resolve, reject) {
promise.then(function (val) {
return hasCanceled_ ? reject(CANCELATION_MESSAGE) : resolve(val);
});
promise["catch"](reject);
});
return wrappedPromise.cancel = function () {
return hasCanceled_ = true;
}, wrappedPromise;
}
export { CANCELATION_MESSAGE, makeCancelable as default };