mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-11-30 10:42:34 +05:30
30 lines
611 B
JavaScript
30 lines
611 B
JavaScript
// On page initialization loader is already visible, so initial value is 1
|
|
let stack = 1;
|
|
|
|
export default {
|
|
show() {
|
|
if (++stack >= 0) {
|
|
const loader = document.getElementById('loader');
|
|
|
|
if (!loader) {
|
|
throw new Error('Can not find loader element');
|
|
}
|
|
|
|
loader.classList.add('is-active');
|
|
}
|
|
},
|
|
|
|
hide() {
|
|
if (--stack <= 0) {
|
|
stack = 0;
|
|
const loader = document.getElementById('loader');
|
|
|
|
if (!loader) {
|
|
throw new Error('Can not find loader element');
|
|
}
|
|
|
|
loader.classList.remove('is-active', 'is-first-launch');
|
|
}
|
|
},
|
|
};
|