##// END OF EJS Templates
Added 'Attrs', 'Events' type parameters to DjxWidgetBase, typed 'on' and 'emit' methods
Added 'Attrs', 'Events' type parameters to DjxWidgetBase, typed 'on' and 'emit' methods

File last commit:

r8:6d80d7901b4c v1.0.0-rc3 default
r30:a46488b209e8 v1.0.0-rc14 default
Show More
TestTraits.ts
60 lines | 1.9 KiB | video/mp2t | TypeScriptLexer
cin
Initial commit, copied files related to .tsx scripts support.
r0 import { IObservable, ICancellation, IDestroyable } from "@implab/core-amd/interfaces";
import { Cancellation } from "@implab/core-amd/Cancellation";
import { TraceEvent, LogLevel, WarnLevel, DebugLevel, TraceSource } from "@implab/core-amd/log/TraceSource";
import { argumentNotNull, destroy } from "@implab/core-amd/safe";
cin
typescript strict mode...
r1 import { TapWriter } from "./Tap";
cin
Initial commit, copied files related to .tsx scripts support.
r0
export class TapeWriter implements IDestroyable {
cin
typescript strict mode...
r1
private readonly _t: TapWriter;
cin
Initial commit, copied files related to .tsx scripts support.
r0
private readonly _subscriptions = new Array<IDestroyable>();
cin
created typings for basic part of dojo and dijit further work is required to...
r2 private _destroyed = false;
cin
Initial commit, copied files related to .tsx scripts support.
r0
cin
typescript strict mode...
r1 constructor(t: TapWriter) {
argumentNotNull(t, "test");
cin
created typings for basic part of dojo and dijit further work is required to...
r2 this._t = t;
cin
Initial commit, copied files related to .tsx scripts support.
r0 }
writeEvents(source: IObservable<TraceEvent>, ct: ICancellation = Cancellation.none) {
if (!this._destroyed) {
const subscription = source.on(this.writeEvent.bind(this));
if (ct.isSupported()) {
ct.register(subscription.destroy.bind(subscription));
}
this._subscriptions.push(subscription);
}
}
writeEvent(next: TraceEvent) {
if (next.level >= DebugLevel) {
cin
typescript strict mode...
r1 this._t.comment(`DEBUG ${next.source.id} ${next}`);
cin
Initial commit, copied files related to .tsx scripts support.
r0 } else if (next.level >= LogLevel) {
cin
typescript strict mode...
r1 this._t.comment(`LOG ${next.source.id} ${next}`);
cin
Initial commit, copied files related to .tsx scripts support.
r0 } else if (next.level >= WarnLevel) {
cin
typescript strict mode...
r1 this._t.comment(`WARN ${next.source.id} ${next}`);
cin
Initial commit, copied files related to .tsx scripts support.
r0 } else {
cin
typescript strict mode...
r1 this._t.comment(`ERROR ${next.source.id} ${next}`);
cin
Initial commit, copied files related to .tsx scripts support.
r0 }
}
destroy() {
cin
created typings for basic part of dojo and dijit further work is required to...
r2 if (this._destroyed)
return;
this._destroyed = true;
cin
Initial commit, copied files related to .tsx scripts support.
r0 this._subscriptions.forEach(destroy);
}
}
cin
created typings for basic part of dojo and dijit further work is required to...
r2 type TestCallback = (ok: (msg: string) => void, fail: (msg: string) => void, trace: TraceSource) => void;
type AsyncTestCallback = (trace: TraceSource) => PromiseLike<void>;
cin
Initial commit, copied files related to .tsx scripts support.
r0
cin
typescript strict mode...
r1 export function test(name: string, cb: TestCallback | AsyncTestCallback) {
cin
created typings for basic part of dojo and dijit further work is required to...
r2
cin
typescript strict mode...
r1 }
cin
Initial commit, copied files related to .tsx scripts support.
r0
cin
typescript strict mode...
r1 export function run() {
cin
Initial commit, copied files related to .tsx scripts support.
r0
}