openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
21 lines (20 loc) • 671 B
JavaScript
import "./src-BPmQBLJp.mjs";
//#region src/infra/abort-signal.ts
function isAbortError(e) {
if (!e || typeof e !== "object") return false;
try {
if (("name" in e ? String(e.name) : "") === "AbortError") return true;
return ("message" in e && typeof e.message === "string" ? e.message : "") === "This operation was aborted";
} catch {
return false;
}
}
/** Resolves when the signal aborts, or immediately when no wait is needed. */
async function waitForAbortSignal(e) {
if (!e || e.aborted) return;
await new Promise((t) => {
e.addEventListener("abort", () => t(), { once: true });
});
}
//#endregion
export { waitForAbortSignal as n, isAbortError as t };