2018-03-26 00:46:45 +05:30
|
|
|
// On page initialization loader is already visible, so initial value is 1
|
|
|
|
let stack = 1;
|
|
|
|
|
2016-11-19 15:04:19 +05:30
|
|
|
export default {
|
2019-11-27 14:33:32 +05:30
|
|
|
show() {
|
|
|
|
if (++stack >= 0) {
|
2019-12-07 16:58:52 +05:30
|
|
|
const loader = document.getElementById('loader');
|
|
|
|
|
|
|
|
if (!loader) {
|
|
|
|
throw new Error('Can not find loader element');
|
|
|
|
}
|
|
|
|
|
|
|
|
loader.classList.add('is-active');
|
2019-11-27 14:33:32 +05:30
|
|
|
}
|
|
|
|
},
|
2016-11-19 15:04:19 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
hide() {
|
|
|
|
if (--stack <= 0) {
|
|
|
|
stack = 0;
|
2019-12-07 16:58:52 +05:30
|
|
|
const loader = document.getElementById('loader');
|
|
|
|
|
|
|
|
if (!loader) {
|
|
|
|
throw new Error('Can not find loader element');
|
|
|
|
}
|
|
|
|
|
|
|
|
loader.classList.remove('is-active', 'is-first-launch');
|
2016-11-19 15:04:19 +05:30
|
|
|
}
|
2019-11-27 14:33:32 +05:30
|
|
|
},
|
2016-11-19 15:04:19 +05:30
|
|
|
};
|