##// END OF EJS Templates
fixed strict mode @bind decorator
fixed strict mode @bind decorator

File last commit:

r7:d14fb562b896 default
r28:b88fac0e76c0 v1.0.0-rc13 default
Show More
tsx.ts
33 lines | 1.0 KiB | video/mp2t | TypeScriptLexer
cin
added 'dom-inject' and 'css' modules
r6 import { Constructor } from "@implab/core-amd/interfaces";
cin
sync
r7 import { HtmlElementContext } from "./tsx/HtmlElementContext";
import { WidgetContext } from "./tsx/WidgetContext";
import { isWidgetConstructor, BuildContext } from "./tsx/traits";
cin
added 'dom-inject' and 'css' modules
r6
export function createElement<T extends Constructor>(elementType: string | T, ...args: any[]): BuildContext {
if (typeof elementType === "string") {
const ctx = new HtmlElementContext(elementType);
if (args)
args.forEach(x => ctx.visitNext(x));
return ctx;
} else if (isWidgetConstructor(elementType)) {
const ctx = new WidgetContext(elementType);
if (args)
args.forEach(x => ctx.visitNext(x));
return ctx;
} else {
throw new Error(`The element type '${elementType}' is unsupported`);
}
}
export interface EventDetails<T = any> {
detail: T;
}
export interface EventSelector {
selectorTarget: HTMLElement;
target: HTMLElement;
}
export type DojoMouseEvent<T = any> = MouseEvent & EventSelector & EventDetails<T>;