##// END OF EJS Templates
Minor fixes and improvements...
Minor fixes and improvements - added `isCancellable` type predicate function to `safe` module - `isString, isNumber, isInteger, isPrimitive` are now type predicates

File last commit:

r50:7a4fac383b10 di-typescript
r71:600f0201c4ba v1.2.16 default
Show More
MockActivationController.ts
43 lines | 1.2 KiB | video/mp2t | TypeScriptLexer
/ src / test / ts / mock / MockActivationController.ts
import { IActivatable, ICancellation, IActivationController } from "@implab/core/interfaces";
import { Cancellation } from "@implab/core/Cancellation";
export class MockActivationController implements IActivationController {
_active: IActivatable = null;
getActive(): IActivatable {
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;
}
}