Skip to content
Buy me a coffee

@ylcnfrht/enhanced-abort-controller

AbortController with .NET CancellationTokenSource powers. The signal stays a real AbortSignal.

import { EnhancedAbortController, TimeSpan, isAbortError } from '@ylcnfrht/enhanced-abort-controller';
using controller = new EnhancedAbortController().abortAfter(TimeSpan.fromSeconds(5));
try {
const response = await fetch(url, { signal: controller.signal });
} catch (error) {
if (!isAbortError(error)) throw error;
}