showLoadingIndicator
Displays a loading indicator overlay across the entire app. Reference counting keeps nested calls safe.
Parameters
timeoutSeconds(number): Auto-hide timeout, in seconds. Pass0to 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
showcall increments an internal counter (_indicatorRefCount) - The overlay appears only when the counter goes from 0 to 1
- Each
hidecall 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 |
|---|---|---|
| Scope | The 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 seconds | 20 seconds |
| One hide after nested shows | Only decrements the counter; still visible | Disappears 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
Related
$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)