// let count: number = 0;
export class LoadingService {
    public static count = 0;
    public Loader: any;
    public body: any;
 
    constructor(){
        this.Loader = document.querySelector('#loading');
        this.body = document.querySelector('body');
    }
    show(){
        if(this.Loader){
            LoadingService.count ++;
            this.Loader.classList.add("d-block");
            this.Loader.classList.remove("d-none");
            this.body.classList.add('no-scroll');
        }
    }

    hide(){
        if(this.Loader){
            LoadingService.count --;

            if(LoadingService.count <= 0){
                LoadingService.count = 0;
                this.Loader.classList.add("d-none");
                this.Loader.classList.remove("d-block");
                this.body.classList.remove('no-scroll');
            }
        }
    }
}