new Loader(options) → {Class}
A loader component that can be used as a simple spinner or a full masked element with spinner and text as needed.
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | object | The options for the component. Properties
|
- Since
- 1.1.16
- Source
The class instance.
- Type:
- Class
import Loader from '@gravityforms/components/html/admin/elements/Loader';
function Example() {
const loaderInstance = new Loader( {
id: 'example-loader',
renderOnInit: false,
target: '#example-target',
targetPosition: 'beforeend',
theme: 'cosmos',
} );
// Some time later we can render it. This is only done if we set renderOnInit to false.
// If true it will render on initialization.
loaderInstance.init();
}
Methods
(static) hideLoader() → {void}
Hide the loader.
- Since
- 1.1.16
- Source
- Type:
- void
(static) init() → {void}
Initialize the component.
- Since
- 1.1.16
- Source
- Type:
- void
(static) loaderTemplate(options) → {string}
Generates the markup for a loader in the admin.
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | object | The options for the component template. Properties
|
- Since
- 1.1.16
- Source
- Type:
- string
import { loaderTemplate } from '@gravityforms/components/html/admin/elements/Loader';
function Example() {
const loaderTemplateHTML = loaderTemplateTemplate( options );
document.body.insertAdjacentHTML( 'beforeend', loaderTemplateHTML );
}
(static) positionLoader() → {void}
Sets the vertical position for the loader.
- Since
- 1.1.16
- Source
- Type:
- void
(static) removeLoader() → {void}
Removes the injected nodes from the dom.
- Since
- 1.1.16
- Source
- Type:
- void
(static) render() → {void}
Renders the component into the dom.
- Since
- 1.1.16
- Source
- Type:
- void
(static) setInitialUI() → {void}
Handles initial visibility for the loader. If showOnRender is false, hides the loader.
- Since
- 1.1.16
- Source
- Type:
- void
(static) showLoader() → {void}
Reveal the loader.
- Since
- 1.1.16
- Source
- Type:
- void
(static) storeElements() → {void}
Store the elements on the elements object of this instance.
- Since
- 1.1.16
- Source
- Type:
- void