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