##// END OF EJS Templates
Added tag 1.0.0-rc17 for changeset a1a1ef050ecc
Added tag 1.0.0-rc17 for changeset a1a1ef050ecc

File last commit:

r34:e8012fdf09ae 1.0.0-rc16 default
r37:2e8680269302 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;
}
}