Namespace

loadingSpinner

kiss.loadingSpinner

Simple module to handle a global loading spinner.

When multiple components needs to lock the UI while they are loading, it can be tricky to know when to show and hide the loading screen. This module solves the problem by mutualizing the loading screen between components.

View Source client/core/modules/loadingSpinner.js, line 11

Methods

# static hide(loadingId)

Hide the loading spinner.

Note: it will hide the loading spinner only if there is no more loading components in the buffer.

Parameters:
Name Type Description
loadingId string

The unique id given by the kiss.loadingSpinner.show() method

View Source client/core/modules/loadingSpinner.js, line 83

# static show() → {string}

Show the loading spinner.

View Source client/core/modules/loadingSpinner.js, line 63

A unique id used later to hide the loading spinner

string
Example
// To show the loading spinner
const loadingId = kiss.loadingSpinner.show()

// To hide the loading spinner
kiss.loadingSpinner.hide(loadingId)

// With multiple components loading in parallel:
const loadingComponent1 = kiss.loadingSpinner.show()
const loadingComponent2 = kiss.loadingSpinner.show()

kiss.loadingSpinner.hide(loadingComponent1) // This will not hide the spinner because component 2 is still loading
kiss.loadingSpinner.hide(loadingComponent2) // This will hide the spinner because there are no more components loading