StaticenableCreates a new element, inserts it into the document body and configures it as a PageLoader.
Optionalconfig: PageLoaderConfigStaticgetIf element is omitted, returns the instance created by enableMain if any.
Optionalelement: ElementStaticregisterOptionalconfig: PageLoaderConfigReadonlydestroyUndoes 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.
ReadonlydisableDisables the functionality of the widget. What this means is specific to each widget.
ReadonlyenableRe-enables the functionality of the widget. What this means is specific to each widget.
ReadonlygetReturns the element passed to the widget constructor.
ReadonlyisReturns true if the widget is destroyed.
ReadonlyisReturns true if the widget is currently disabled.
ReadonlyonThe given handler will be called when the widget is destroyed.
ReadonlyonThe given handler will be called when the widget is disabled.
ReadonlyonThe given handler will be called when the widget is enabled.
ReadonlytoggleRe-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-loaderclass ordata-lisn-page-loaderattribute 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.