##// END OF EJS Templates
fixes to css, nls to support requirejs optimizer
fixes to css, nls to support requirejs optimizer

File last commit:

r34:e8012fdf09ae 1.0.0-rc16 default
r36:a1a1ef050ecc 1.0.0-rc17 default
Show More
FunctionComponentContext.ts
32 lines | 912 B | video/mp2t | TypeScriptLexer
/ src / main / ts / tsx / FunctionComponentContext.ts
import dom = require("dojo/dom-construct");
import attr = require("dojo/dom-attr");
import { argumentNotNull } from "@implab/core-amd/safe";
import { BuildContextBase } from "./BuildContextBase";
export class FunctionComponentContext extends BuildContextBase<Element> {
private _component: (props: any) => Element;
private _element: Element | undefined;
constructor(component: (props: any) => Element) {
super();
argumentNotNull(component, "component");
this._component = component;
}
_create(attrs: object, children: any[]) {
const _attrs: any = attrs || {};
_attrs.children = children.map(x => this.getChildDom(x));
this._element = this._component.call(null, _attrs);
}
_getDomNode() {
if (!this._element)
throw new Error("The instance of the widget isn't created");
return this._element;
}
}