core.utilities / ProgressTracker / <init>

# <init>

`ProgressTracker(vararg steps: Step)`

A progress tracker helps surface information about the progress of an operation to a user interface or API of some kind. It lets you define a set of steps that represent an operation. A step is represented by an object (typically a singleton).

Steps may logically be children of other steps, which models the case where a large top level operation involves sub-operations which may also have a notion of progress. If a step has children, then the tracker will report the steps children as the "next step" after the parent. In other words, a parent step is considered to involve actual reportable work and is a thing. If the parent step simply groups other steps, then youll have to step over it manually.

Each step has a label. It is assumed by default that the label does not change. If you want a label to change, then you can emit a ProgressTracker.Change.Rendering object on the ProgressTracker.Step.changes observable stream after it changes. That object will propagate through to the top level trackers changes stream, which renderers can subscribe to in order to learn about progress.

An operation can move both forwards and backwards through steps, thus, a ProgressTracker can represent operations that include loops.

A progress tracker is not thread safe. You may move events from the thread making progress to another thread by using the Observable subscribeOn call.