app-message-box-service.ts 1.0 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
import { Subject } from "rxjs";
import { AppMessageBox } from "../../utils/app-message-box/app-message-box";
import { MessageBoxOptions } from "../../utils/app-message-box/interface/message-box-options";

/**
 * 对话框服务类
 *
 * @export
 * @class AppMessageBoxService
 */
 export class AppMessageBoxService {

    /**
     * 唯一实例
     * 
     * @private
     * @static
     * @memberof AppMessageBoxService
     */
    private static readonly instance = new AppMessageBoxService();

    /**
     * 获取唯一实例
     *
     * @static
     * @return {*}  {AppMessageBoxService}
     * @memberof AppMessageBoxService
     */
    public static getInstance(): AppMessageBoxService {
        return AppMessageBoxService.instance;
    }

    /**
     * 打开信息提示
     *
     * @param {MessageBoxOptions} options
     * @memberof AppMessageBoxService
     */
    public open(options: MessageBoxOptions):Subject<any>|null{
        if(!options){
            return null;
        }
        return AppMessageBox.getInstance().open(options);
    }
}