Files
AFFiNE-Mirror/packages/common/nbstore/src/utils/throw-if-aborted.ts
T
2024-12-07 08:05:02 +00:00

10 lines
264 B
TypeScript

// because AbortSignal.throwIfAborted is not available in abortcontroller-polyfill
export function throwIfAborted(abort?: AbortSignal) {
if (abort?.aborted) {
throw new Error(abort.reason);
}
return true;
}
export const MANUALLY_STOP = 'manually-stop';