counter-service.ts 1.0 KB
Newer Older
ibizdev's avatar
ibizdev committed
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
import { Store } from 'vuex';

/**
 * 计数器服务基类
 *
 * @export
 * @class CounterService
 */
export default class CounterService {

    /**
     * Vue 状态管理器
     *
     * @private
     * @type {(any | null)}
     * @memberof CounterService
     */
    private $store: Store<any> | null = null;

    /**
     * Creates an instance of CounterService.
     * 
     * @param {*} [opts={}]
     * @memberof CounterService
     */
    constructor(opts: any = {}) {
        this.$store = opts.$store;
    }

    /**
     * 获取状态管理器
     *
     * @returns {(any | null)}
     * @memberof CounterService
     */
    public getStore(): Store<any> | null {
        return this.$store;
    }

    /**
     * 获取计数器服务
     *
     * @protected
     * @param {string} name 实体名称
     * @returns {Promise<any>}
     * @memberof CounterService
     */
    public getService(name: string): Promise<any> {
        return (window as any)['counterServiceRegister'].getService(name);
    }

   
}