Ui-Preloader is a simple vanilla js component for simple messages in the browser.
Install the package
npm i ui-preloader --save
import {Â init as UiPreloaderInit } from 'ui-preloader';
Download the file ui-preloader.js in the js/dist/
folder and place it into your html file.
...
<body>
...
<script src="ui-prelader.js"></script>
<script>
// use here
</script>
</body>
To create a preloader component you just need to call the init function. The first argument is the root. It´s the container where the component gets inserted. Root is by default the body element.
init(root <HTML Element>)
const myPreloader = init(document.querySelector('.container'));
destroy()
Once you create an inheritance and the preloader is not needed anymore
you can just call the destroy method to remove it from the dom.
myPreloader.destroy()