36 lines
783 B
TypeScript
36 lines
783 B
TypeScript
import { loadingModalObj } from "@/context/LoadingModalContext";
|
|
import CSMask from "../CSMask";
|
|
|
|
export default abstract class LoadMaskBase {
|
|
/** 一般遮罩記數 */
|
|
private _count: number = 0;
|
|
public get MaskType(): CSMask.MaskType { throw new Error(`請初始化MaskType`); }
|
|
|
|
onLoad() {
|
|
this._count = 0;
|
|
}
|
|
|
|
public Show(...param: any[]): void {
|
|
if (this._count == 0) {
|
|
const { handleOpen } = loadingModalObj;
|
|
handleOpen();
|
|
}
|
|
this._count++;
|
|
}
|
|
|
|
public Hide(...param: any[]): void {
|
|
this._count--;
|
|
if (this._count <= 0) {
|
|
const { handleClose } = loadingModalObj;
|
|
handleClose();
|
|
this._count = 0;
|
|
}
|
|
}
|
|
|
|
public Reset(): void {
|
|
this._count = 0;
|
|
const { handleClose } = loadingModalObj;
|
|
handleClose();
|
|
}
|
|
}
|