##// END OF EJS Templates
Added tag v1.7.1 for changeset 8095aad89415
Added tag v1.7.1 for changeset 8095aad89415

File last commit:

r118:e07418577cbc v1.6.1 default
r128:ccd49a7b1772 default
Show More
Scope.ts
42 lines | 1.2 KiB | video/mp2t | TypeScriptLexer
cin
Added Renderer, WatchRendition
r94 import { IDestroyable, IRemovable } from "@implab/core-amd/interfaces";
import { isDestroyable, isRemovable } from "@implab/core-amd/safe";
cin
added whenRendered() method to wait for pending oprations to complete
r118 import { isUnsubscribable, Unsubscribable } from "../observable";
cin
Added Renderer, WatchRendition
r94
export interface IScope {
cin
`Subscribable` is made compatible with rxjs, added map, filter and scan...
r102 own(target: (() => void) | IDestroyable | IRemovable | Unsubscribable): void;
cin
Added Renderer, WatchRendition
r94 }
export class Scope implements IDestroyable, IScope {
private readonly _cleanup: (() => void)[] = [];
static readonly dummy: IScope = { own() { } };
cin
`Subscribable` is made compatible with rxjs, added map, filter and scan...
r102 own(target: (() => void) | IDestroyable | IRemovable | Unsubscribable) {
cin
Added Renderer, WatchRendition
r94 if (target instanceof Function) {
this._cleanup.push(target);
} else if (isDestroyable(target)) {
this._cleanup.push(() => target.destroy());
} else if (isRemovable(target)) {
this._cleanup.push(() => target.remove());
cin
added whenRendered() method to wait for pending oprations to complete
r118 } else if (isUnsubscribable(target)) {
cin
`Subscribable` is made compatible with rxjs, added map, filter and scan...
r102 this._cleanup.push(() => target.unsubscribe());
cin
Added Renderer, WatchRendition
r94 }
}
clean() {
const guard = (cb: () => void) => {
try {
cb();
} catch {
// guard
}
cin
linting
r109 };
cin
Added Renderer, WatchRendition
r94
this._cleanup.forEach(guard);
this._cleanup.length = 0;
}
destroy() {
this.clean();
}
}