UNPKG

@adyen/adyen-platform-experience-web

Version:

![Platform Experience header](https://github.com/Adyen/adyen-platform-experience-web/assets/7926613/18094965-9e01-450e-8dc9-ea84e6b22c2b)

28 lines (27 loc) 839 B
import { struct as u } from "../../../utils/struct/main.js"; import { enumerable as n, getter as s } from "../../../utils/struct/property.js"; import { isUndefined as b } from "../../../utils/value/is.js"; import { noop as _ } from "../../../utils/common.js"; const w = (o) => { let r, t, e; const f = () => { if (b(r)) return; const i = r.abort.bind(r); r = void 0, i(); }, l = () => (e = new Promise((i, c) => { if (t.addEventListener("abort", function d() { t.removeEventListener("abort", d), c(o); }), t.aborted) throw o; }), e.catch(_), e), a = () => (b(r) && (r = new AbortController(), t = r.signal, e = l()), m), m = u({ abort: n(f), promise: s(() => e), reason: n(o), refresh: n(a), signal: s(() => t) }); return a(); }; export { w as createAbortable, w as default };