##// END OF EJS Templates
Added tag v1.1.0 for changeset 1a0018655d1c
Added tag v1.1.0 for changeset 1a0018655d1c

File last commit:

r63:1a0018655d1c v1.1.0 default
r64:3f27d1084ced default
Show More
FunctionRendition.ts
29 lines | 801 B | video/mp2t | TypeScriptLexer
/ src / main / ts / tsx / FunctionRendition.ts
import { argumentNotNull } from "@implab/core-amd/safe";
import { RenditionBase } from "./RenditionBase";
export class FunctionRendition extends RenditionBase<Node> {
private _component: (props: any) => any;
private _node: Node | undefined;
constructor(component: (props: any) => any) {
super();
argumentNotNull(component, "component");
this._component = component;
}
_create(attrs: object, children: any[]) {
const _attrs: any = attrs || {};
_attrs.children = children.map(x => this.getItemDom(x));
this._node = this.getItemDom(this._component.call(null, _attrs));
}
_getDomNode() {
if (!this._node)
throw new Error("The instance of the widget isn't created");
return this._node;
}
}