Static
enableCreates a new element, inserts it into the document body and configures it as a PageLoader.
Optional
config: PageLoaderConfigStatic
getIf element is omitted, returns the instance created by enableMain if any.
Optional
element: ElementStatic
registerOptional
config: PageLoaderConfigReadonly
destroyUndoes all modifications to the element and returns it to its original state.
You will need to recreate it if you want to enable its functionality again.
Readonly
disableDisables the functionality of the widget. What this means is specific to each widget.
Readonly
enableRe-enables the functionality of the widget. What this means is specific to each widget.
Readonly
getReturns the element passed to the widget constructor.
Readonly
isReturns true if the widget is destroyed.
Readonly
isReturns true if the widget is currently disabled.
Readonly
onThe given handler will be called when the widget is destroyed.
Readonly
onThe given handler will be called when the widget is disabled.
Readonly
onThe given handler will be called when the widget is enabled.
Readonly
toggleRe-enables the widget if disabled, otherwise disables it.
Configures the given element as a PageLoader widget.
The page loader is a full-page spinner. You would almost certainly use this only once, to hide the page before it's loaded.
IMPORTANT: You should not instantiate more than one PageLoader widget on a given element. Use PageLoader.get to get an existing instance if any. If there is already a widget instance, it will be destroyed!
To use with auto-widgets (HTML API) (see settings.autoWidgets), the following CSS classes or data attributes are recognized:
lisn-page-loader
class ordata-lisn-page-loader
attribute set on the element that constitutes the widget. The element should be empty.See below examples for what values you can use set for the data attributes in order to modify the configuration of the automatically created widget.
Example
This will create a page loader using the JavaScript API.
This will work even if settings.autoWidgets) is false
Example
This will create a page loader using an existing element with default PageLoaderConfig.
Example
As above but with custom settings.