2018-03-25 22:16:45 +03:00
|
|
|
// On page initialization loader is already visible, so initial value is 1
|
|
|
|
let stack = 1;
|
|
|
|
|
2016-11-19 11:34:19 +02:00
|
|
|
export default {
|
2019-11-27 11:03:32 +02:00
|
|
|
show() {
|
|
|
|
if (++stack >= 0) {
|
2019-12-07 13:28:52 +02:00
|
|
|
const loader = document.getElementById('loader');
|
|
|
|
|
|
|
|
if (!loader) {
|
|
|
|
throw new Error('Can not find loader element');
|
|
|
|
}
|
|
|
|
|
|
|
|
loader.classList.add('is-active');
|
2019-11-27 11:03:32 +02:00
|
|
|
}
|
|
|
|
},
|
2016-11-19 11:34:19 +02:00
|
|
|
|
2019-11-27 11:03:32 +02:00
|
|
|
hide() {
|
|
|
|
if (--stack <= 0) {
|
|
|
|
stack = 0;
|
2019-12-07 13:28:52 +02:00
|
|
|
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 11:34:19 +02:00
|
|
|
}
|
2019-11-27 11:03:32 +02:00
|
|
|
},
|
2016-11-19 11:34:19 +02:00
|
|
|
};
|