##// END OF EJS Templates
Added childContainer service to container services, ServiceContaier is destroyable, fixed browser Uuid version
Added childContainer service to container services, ServiceContaier is destroyable, fixed browser Uuid version

File last commit:

r115:691199f665e0 ioc ts support
r146:f3f5c56d3b3e v1.4.0-rc5 default
Show More
MockActivationController.ts
49 lines | 1.3 KiB | video/mp2t | TypeScriptLexer
/ src / test / ts / mock / MockActivationController.ts
cin
migrating tests to the new project structure
r89 import { IActivatable, ICancellation, IActivationController } from "../interfaces";
import { Cancellation } from "../Cancellation";
cin
tests moved under src/ folder...
r50
export class MockActivationController implements IActivationController {
cin
corrected code to support ts strict mode...
r115 _active: IActivatable | null = null;
hasActive() {
return !!this._active;
}
cin
tests moved under src/ folder...
r50
getActive(): IActivatable {
cin
corrected code to support ts strict mode...
r115 if (!this._active)
throw new Error("No active component is set");
cin
tests moved under src/ folder...
r50 return this._active;
}
async deactivate() {
if (this._active)
await this._active.deactivate();
this._active = null;
}
async activate(component: IActivatable) {
if (!component || component.isActive())
return;
component.setActivationController(this);
await component.activate();
}
async activating(component: IActivatable, ct: ICancellation = Cancellation.none) {
if (component !== this._active)
await this.deactivate();
}
async activated(component: IActivatable, ct: ICancellation = Cancellation.none) {
this._active = component;
}
async deactivating(component: IActivatable, ct: ICancellation = Cancellation.none) {
}
async deactivated(component: IActivatable, ct: ICancellation = Cancellation.none) {
if (this._active === component)
this._active = null;
}
}