Skip to main content

showLoadingIndicator

Displays a loading indicator overlay across the entire app. Reference counting keeps nested calls safe.

Parameters

  • timeoutSeconds (number): Auto-hide timeout, in seconds. Pass 0 to apply the default of 10 seconds

Returns

None (void)

Description

Displays the loading indicator on lucyNavigator.context — the app root overlay. It works by reference counting.

  • Each show call increments an internal counter (_indicatorRefCount)
  • The overlay appears only when the counter goes from 0 to 1
  • Each hide call decrements the counter, and the overlay hides only when the counter reaches 0

So when several async requests overlap, simply match the number of show and hide calls and everything behaves correctly.

$app vs $form detailed comparison

Item$app.showLoadingIndicator$form.showLoadingIndicator
ScopeThe whole app (root overlay)Only that form's area
Reference counting✅ Yes — nested calls are safe❌ No — shows and hides immediately
Default timeout (when you pass 0)10 seconds20 seconds
One hide after nested showsOnly decrements the counter; still visibleDisappears immediately

When to use $app

  • When you need to block the entire app — during login, global initialization, and similar work
  • When several async requests overlap and the indicator must stay until all of them finish

When to use $form

  • When you want to show only one form's area as loading
  • Single requests with no nesting

Example

// Specify a timeout
$app.showLoadingIndicator(5);
$http.get("/api/data", function(res) {
$app.hideLoadingIndicator();
});

// Nested calls (N shows require N hides)
$app.showLoadingIndicator(0); // refCount: 1
$app.showLoadingIndicator(0); // refCount: 2
$app.hideLoadingIndicator(); // refCount: 1, still visible
$app.hideLoadingIndicator(); // refCount: 0, now hidden
  • $app.hideLoadingIndicator() — Hides the app loading indicator (reference counted)
  • $app.setUseLoadingIndicator(enabled) — Turns the automatic indicator on or off
  • $form.showLoadingIndicator(timeoutSeconds) — Loading indicator for the form area only (no counting)