Create an AbortSignal that aborts after a delay
npm install timeout-signal
import timeoutSignal from 'timeout-signal';
const signal = timeoutSignal(5000);
try {
const response = await fetch('https://www.google.com', {signal});
// Handle response
} catch (error) {
if (signal.aborted) {
// Handle abortion
}
}
Type: integer
The milliseconds to wait.