view-loading-service.ts 1.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
/**
 * 视图加载服务
 *
 * @export
 * @class ViewLoadingService
 * @extends {LoadingServiceBase}
 */
 export class ViewLoadingService {

    /**
     * 视图loading计数器
     *
     * @type {number}
     * @memberof ViewLoadingService
     */
    public loadingCounter: number = 0
    
    /**
     * 视图loading状态变量,true时正在loading
     *
     * @type {boolean}
     * @memberof ViewLoadingService
     */
    public isLoading:boolean = false;

    /**
     * 主视图sessionid
     *
     * @type {string[]}
     * @memberof ViewLoadingService
     */
    public srfsessionid: string = '';

    /**
     * 开启视图loading
     *
     * @memberof ViewLoadingService
     */
    public beginLoading(){
        this.loadingCounter++;
        if(!this.isLoading){
            this.isLoading = true;
        }
    }

    /**
     * 关闭视图loading
     *
     * @memberof ViewLoadingService
     */
    public endLoading(){
        this.loadingCounter--;
        if(this.isLoading && this.loadingCounter == 0){
            this.isLoading = false;
        }
    }


}