6 lines
180 B
TypeScript
6 lines
180 B
TypeScript
|
export function deadline(timeout: number): AbortSignal {
|
||
|
const controller = new AbortController();
|
||
|
setTimeout(() => controller.abort(), timeout);
|
||
|
return controller.signal;
|
||
|
}
|