sdk.progress.makeprogressiblepromise
Home > @matterway/sdk > Progress > makeProgressiblePromise
Progress.makeProgressiblePromise() function
Makes a promise a Progressible by adding the status of the running task to the context.
Signature:
export declare function makeProgressiblePromise<T>(ctx: JobContext, fn: JobHandler<T>): () => Promise<T | Error>;
Parameters
Parameter | Type | Description |
---|---|---|
ctx | JobContext | Context object. |
fn | JobHandler<T> | Promise function. |
Returns:
() => Promise<T | Error>
Example
const ctx = {};
const handler = await Promise.resolve();
const progressible = makeProgressiblePromise(ctx, handler);
return progressible;