Skip to content

getProgressBar()

Provides access to the shared LAIKA progress-bar state and controls.

LAIKA uses this singleton internally for router navigation. Calling getProgressBar() returns the same reactive state used by the built-in <ProgressBar />.

Basic Usage

ts
import { getProgressBar } from '@ratmd/laika';

const progress = getProgressBar();

progress.start();

try {
    await performAsyncWork();
} finally {
    progress.done();
}

State

The state object is reactive and shared by every caller.

PropertyTypeDescription
activebooleanWhether the progress bar is visible.
percentnumberCurrent completion percentage.
colorstringFallback color used by the component.
timestampnumberTime at which the current progress operation started.

Available Methods

Calling done() while the bar is inactive has no effect unless force is true.

MethodDescription
start()Activates the bar at 10% and advances it gradually toward 90%.
done(force?)Advances to 100%, then hides and resets the bar.
fail()Forces the same completion sequence after a failed operation.

NOTE

Router visits control this state automatically. Manual controls are intended for asynchronous work that does not pass through the LAIKA router.

This software is not an official OctoberCMS product and is not associated with, sponsored by, or endorsed by OctoberCMS.