Skip to main content

Page Action | Loading

info

Introduced in v0.20.0 of the SDK.

The page.loading() method makes it easy to build flexible loading states into your apps. It also exposes useful parameters for disabling user interaction while loading, showing different loading texts to indicate different stages of loading, and more.

page.loading(true, { disableInteraction: true, text: "Step 1..." })

await expensiveOperation()

page.loading(true, { text: "Step 2..." })

await expensiveOperation()

page.loading(false)

API reference

Function signature

page.loading(
value: boolean,
properties?: Partial<{
text: string;
disableInteraction: boolean;
}>
): void

Parameters

value

required boolean
Whether to show the loading indicator or not.

properties.text

optional string
Specify a custom text for the loading indicator. You can call page.loading() multiple times with different texts to indicate different stages of loading.

properties.disableInteraction

optional boolean
Whether to disable user interaction on the page while the loading indicator is shown. Defaults to false.

Returns

void