##// END OF EJS Templates
added form/Form widget and form/_FormMixin, this is a rewritten version of the corresponding dojo classed....
added form/Form widget and form/_FormMixin, this is a rewritten version of the corresponding dojo classed. bind hooks are now specifing 'priority=false' parameter in setters. This will prevent excessive triggering of onChange events.

File last commit:

r131:c7d9ad82b374 v1.8.1 default
r134:f139e2153e0d v1.9.0-rc1 default
Show More
Scope.ts
54 lines | 1.4 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 }
cin
Corrected Scope.own() to cleanup the supplied object immediately when the scope is disposed already
r131 const guard = (cb: () => void) => {
try {
cb();
} catch {
// guard
}
};
cin
Added Renderer, WatchRendition
r94 export class Scope implements IDestroyable, IScope {
cin
Corrected Scope.own() to cleanup the supplied object immediately when the scope is disposed already
r131 private readonly _pending: (() => void)[] = [];
private _disposed = false;
cin
Added Renderer, WatchRendition
r94
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) {
cin
Corrected Scope.own() to cleanup the supplied object immediately when the scope is disposed already
r131 this._own(target);
cin
Added Renderer, WatchRendition
r94 } else if (isDestroyable(target)) {
cin
Corrected Scope.own() to cleanup the supplied object immediately when the scope is disposed already
r131 this._own(() => target.destroy());
cin
Added Renderer, WatchRendition
r94 } else if (isRemovable(target)) {
cin
Corrected Scope.own() to cleanup the supplied object immediately when the scope is disposed already
r131 this._own(() => target.remove());
cin
added whenRendered() method to wait for pending oprations to complete
r118 } else if (isUnsubscribable(target)) {
cin
Corrected Scope.own() to cleanup the supplied object immediately when the scope is disposed already
r131 this._own(() => target.unsubscribe());
cin
Added Renderer, WatchRendition
r94 }
}
cin
Corrected Scope.own() to cleanup the supplied object immediately when the scope is disposed already
r131 private _own(target: () => void) {
if (this._disposed)
guard(target);
else
this._pending.push(target);
}
cin
Added Renderer, WatchRendition
r94 clean() {
cin
Corrected Scope.own() to cleanup the supplied object immediately when the scope is disposed already
r131 this._pending.forEach(guard);
this._pending.length = 0;
cin
Added Renderer, WatchRendition
r94 }
destroy() {
cin
Corrected Scope.own() to cleanup the supplied object immediately when the scope is disposed already
r131 if (!this._disposed) {
this._disposed = true;
this.clean();
}
cin
Added Renderer, WatchRendition
r94 }
}