Used to build a single [[CancellablePromise]] from a multi-step asynchronous flow.
CancellablePromise
When the overall promise is canceled, each captured promise is canceled. In practice, this means the active asynchronous operation is canceled.
function query(id: number): CancellablePromise<QueryResult> { return buildCancellablePromise(async capture => { const result1 = await capture(api.method1(id)) // do some stuff const result2 = await capture(api.method2(result1.id)) return { result1, result2 } })}
an async function that takes in a capture function and returns a regular Promise
capture
Promise
Generated using TypeDoc
Used to build a single [[
CancellablePromise
]] from a multi-step asynchronous flow.When the overall promise is canceled, each captured promise is canceled. In practice, this means the active asynchronous operation is canceled.