##// END OF EJS Templates
Added tag v1.2.0 for changeset fdde09e66c00
Added tag v1.2.0 for changeset fdde09e66c00

File last commit:

r67:ff3695b0a48f v1.1.1 default
r74:8d7c7f8418be default
Show More
FunctionRendition.ts
30 lines | 878 B | video/mp2t | TypeScriptLexer
/ djx / 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: (...args: any[]) => any;
private _node: Node | undefined;
constructor(component: (...args: any[]) => any) {
super();
argumentNotNull(component, "component");
this._component = component;
}
protected _create(attrs: object, children: any[]) {
const _attrs: any = attrs || {};
const _children = children.map(x => this.getItemDom(x));
this._node = this.getItemDom(
this._component.call(null, { ..._attrs, children: _children })
);
}
protected _getDomNode() {
if (!this._node)
throw new Error("The instance of the widget isn't created");
return this._node;
}
}