##// END OF EJS Templates
fixed NlsBundle locale package loading...
fixed NlsBundle locale package loading corrected DjxFragment params and return value fixed regression in DjxWidgetBase attach points processing fixed empty RenditionBase startup

File last commit:

r109:4a375b9c654a default
r112:2ccfaae984e9 v1.4.4 default
Show More
FunctionRendition.ts
30 lines | 922 B | video/mp2t | TypeScriptLexer
/ djx / src / main / ts / tsx / FunctionRendition.ts
import { argumentNotNull } from "@implab/core-amd/safe";
import { getItemDom } from "./render";
import { RenditionBase } from "./RenditionBase";
export class FunctionRendition extends RenditionBase<Node> {
private readonly _component: (...args: unknown[]) => unknown;
private _node: Node | undefined;
constructor(component: (...args: unknown[]) => unknown) {
super();
argumentNotNull(component, "component");
this._component = component;
}
protected _create(attrs: object, children: unknown[]) {
const _attrs = attrs || {};
const _children = children.map(x => getItemDom(x));
this._node = 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;
}
}