Appearance
@loontail/minecraft-kit / InstallProgressTracker
Type Alias: InstallProgressTracker
ts
type InstallProgressTracker = {
onEvent: ProgressListener;
finish: void;
snapshot: ProgressSnapshot;
subscribe: () => void;
};Defined in: src/install/progress-tracker.ts:115
Aggregator returned by createInstallProgressTracker. Wire onEvent into install.run / repair.run, and subscribe into your UI layer.
Example
ts
import { createInstallProgressTracker, type InstallProgressTracker } from "@loontail/minecraft-kit";
const tracker: InstallProgressTracker = createInstallProgressTracker(plan);
const unsubscribe = tracker.subscribe((s) => renderBar(s));
await kit.install.run(plan, { onEvent: tracker.onEvent });
tracker.finish();
unsubscribe();Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
onEvent | readonly | ProgressListener | Pass directly as the onEvent callback to install.run / repair.run. | src/install/progress-tracker.ts:117 |
Methods
finish()
ts
finish(): void;Defined in: src/install/progress-tracker.ts:128
Force-emit a final snapshot and stop the throttle timer. The snapshot's stage is finalize, whose byte pair carries the bytes the run ACTUALLY moved — so a run that downloaded everything ends at 100%, while one that failed or was cancelled ends where it stopped instead of claiming the whole plan. overallBytesDownloaded / overallTotalBytes are left untouched, so overallPercent stays the honest figure on every path.
Returns
void
snapshot()
ts
snapshot(): ProgressSnapshot;Defined in: src/install/progress-tracker.ts:118
Returns
subscribe()
ts
subscribe(listener): () => void;Defined in: src/install/progress-tracker.ts:120
First push fires immediately with the initial snapshot.
Parameters
| Parameter | Type |
|---|---|
listener | (snapshot) => void |
Returns
() => void