Skip to main content

Home > flowp > Progress

Progress class

&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;

Create a promise, but with progress reporting

Signature:

export declare class Progress<Result = unknown, CurrentProgress = unknown> extends Future<Result> 

Extends: Future<Result>

Constructors

ConstructorModifiersDescription
(constructor)(initialProgress)(BETA) create a promise, but with progress reporting.

Properties

PropertyModifiersTypeDescription
progressCurrentProgress(BETA) get last reported progress (despite current progress state)

Methods

MethodModifiersDescription
inspect()(BETA) inspect the current progress, for debug purpose only.
onProgress(listener)

(BETA) register a listener on progress report, and use the returned function to cancel listening.

listeners won't receive messages on progress rejection

report(progress)

(BETA) report current progress

no-op if progress has already fulfilled or rejected

run(fn, initialProgress)static

(BETA) 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.