Skip to main content

Home > flowp > Progress > run

Progress.run() method

&gte; This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. &gte;

creates a new progress object and runs the given function with the progress as parameter, returns the created progress object.

the function should report progress and call progress.resolve / progress.reject once done.

Signature:

static run<Result = unknown, CurrentProgress = unknown>(fn: (progress: Progress<Result, CurrentProgress>) => unknown, initialProgress: CurrentProgress): Progress<Result, CurrentProgress>;

Parameters

ParameterTypeDescription
fn(progress: Progress<Result, CurrentProgress>) => unknown
initialProgressCurrentProgress

Returns:

Progress<Result, CurrentProgress>

Example

Progress.run((progress) => {
progress.report(100)
progress.resolve('hello')
}, 0)