import {ObjectBase} from '../common/lang/ObjectBase'; import {ScopeEnum} from '../common/lang/ScopeEnum'; //========================================================== // 后台服务基类。 // // @reference // @author maocy // @version 141231 //========================================================== export class Service extends ObjectBase { // 范围类型 protected _scopeCd: ScopeEnum; // 设置状态 protected _statusSetup: boolean; // 激活状态 protected _statusActive: boolean; // 加载状态 protected _statusLoad: boolean; //========================================================== // 构造处理。 // // @method //========================================================== public constructor() { super(); // 设置属性 this._scopeCd = ScopeEnum.Global; this._statusSetup = false; this._statusActive = false; this._statusLoad = false; } //========================================================== // 获得范围。 // // @return 范围 //========================================================== public get scopeCd(): ScopeEnum { return this._scopeCd; } //========================================================== // 配置处理。 // // @param args 参数 //========================================================== public onSetup(args?: any): void { } //========================================================== // 配置处理。 // // @param args 参数 //========================================================== public setup(args?: any): void { if (!this._statusSetup) { this.onSetup(args); this._statusSetup = true; } } // //========================================================== // // 加载处理。 // // // // @method // //========================================================== // public onLoad(): void { // } // //========================================================== // // 加载处理。 // // // // @method // //========================================================== // public load(): void { // if (!this._statusLoad) { // this.onLoad(); // this._statusLoad = true; // } // } //========================================================== // 激活处理。 //========================================================== public onActive(): void { } //========================================================== // 激活处理。 //========================================================== public active(): void { if (!this._statusActive) { this.onActive(); this._statusActive = true; } } //========================================================== // 取消激活处理。 //========================================================== public onDeactive(): void { } //========================================================== // 取消激活处理。 //========================================================== public deactive(): void { if (this._statusActive) { this.onDeactive(); this._statusActive = false; } } //========================================================== // 卸载处理。 //========================================================== public onUnload(): void { } //========================================================== // 卸载处理。 //========================================================== public unload(): void { if (this._statusLoad) { this.onUnload(); this._statusLoad = false; } } }