sleepWithAbort() — typescript-sdk Function Reference
Architecture documentation for the sleepWithAbort() function in async.ts from the typescript-sdk codebase.
Entity Profile
Dependency Diagram
graph TD f9bbbc22_6269_6b3a_8101_d2e45f03cab9["sleepWithAbort()"] dcc90704_6e64_7ec2_9ee4_aaa5200dbd17["async.ts"] f9bbbc22_6269_6b3a_8101_d2e45f03cab9 -->|defined in| dcc90704_6e64_7ec2_9ee4_aaa5200dbd17 b4433ada_3c32_8526_415a_5f83d7e4401c["pollUntilComplete()"] b4433ada_3c32_8526_415a_5f83d7e4401c -->|calls| f9bbbc22_6269_6b3a_8101_d2e45f03cab9 style f9bbbc22_6269_6b3a_8101_d2e45f03cab9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/async.ts lines 154–182
function sleepWithAbort(ms: number, signal?: AbortSignal): Promise<void> {
return new Promise((resolve, reject) => {
if (signal?.aborted) {
const error = new Error('Polling aborted');
error.name = 'AbortError';
reject(error);
return;
}
const timeout = setTimeout(() => {
if (signal && onAbort) {
signal.removeEventListener('abort', onAbort);
}
resolve();
}, ms);
let onAbort: (() => void) | undefined;
if (signal) {
onAbort = () => {
clearTimeout(timeout);
signal.removeEventListener('abort', onAbort!);
const error = new Error('Polling aborted');
error.name = 'AbortError';
reject(error);
};
signal.addEventListener('abort', onAbort);
}
});
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does sleepWithAbort() do?
sleepWithAbort() is a function in the typescript-sdk codebase, defined in src/async.ts.
Where is sleepWithAbort() defined?
sleepWithAbort() is defined in src/async.ts at line 154.
What calls sleepWithAbort()?
sleepWithAbort() is called by 1 function(s): pollUntilComplete.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free