parent
64849e81f5
commit
a63ec41a7b
|
|
@ -22,9 +22,14 @@ function combineAbortSignals(a?: AbortSignal, b?: AbortSignal): AbortSignal | un
|
||||||
if (b?.aborted) {
|
if (b?.aborted) {
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
if (typeof AbortSignal.any === "function") {
|
if (
|
||||||
return AbortSignal.any([a as AbortSignal, b as AbortSignal]);
|
typeof AbortSignal.any === "function" &&
|
||||||
|
a instanceof AbortSignal &&
|
||||||
|
b instanceof AbortSignal
|
||||||
|
) {
|
||||||
|
return AbortSignal.any([a, b]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const controller = new AbortController();
|
const controller = new AbortController();
|
||||||
const onAbort = () => controller.abort();
|
const onAbort = () => controller.abort();
|
||||||
a?.addEventListener("abort", onAbort, { once: true });
|
a?.addEventListener("abort", onAbort, { once: true });
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue