@adyen/adyen-platform-experience-web
Version:

29 lines (28 loc) • 846 B
JavaScript
import { enumerable as n, hasOwnProperty as o, getter as a } from "../struct/property.js";
import { DEFAULT_ABORT_ERROR_MESSAGE as i } from "./constants.js";
import { sameValue as p } from "../value/compare.js";
if (!o(AbortSignal.prototype, "reason"))
try {
Object.defineProperty(AbortSignal.prototype, "reason", {
...a(function() {
return this.aborted ? e() : void 0;
}, !0),
configurable: !0
});
} catch {
}
o(AbortSignal.prototype, "throwIfAborted") || (AbortSignal.prototype.throwIfAborted = function() {
if (this.aborted) throw this.reason ?? e();
});
const e = (r = i) => new DOMException(r, "AbortError"), s = (r, t) => {
if (!p(r.reason, t))
try {
Object.defineProperty(r, "reason", n(t));
} catch {
}
return r;
};
export {
e as abortError,
s as augmentSignalReason
};