##// END OF EJS Templates
refactoring, adding scope to rendering methods
refactoring, adding scope to rendering methods

File last commit:

r96:a316cfea8bb1 v1.3
r96:a316cfea8bb1 v1.3
Show More
FunctionRendition.ts
33 lines | 984 B | video/mp2t | TypeScriptLexer
/ djx / src / main / ts / tsx / FunctionRendition.ts
cin
Converted to subproject djx, removed dojo-typings
r65 import { argumentNotNull } from "@implab/core-amd/safe";
cin
refactoring, adding scope to rendering methods
r96 import { getItemDom } from "./Renderer";
cin
Converted to subproject djx, removed dojo-typings
r65 import { RenditionBase } from "./RenditionBase";
cin
refactoring, adding scope to rendering methods
r96 import { IScope } from "./Scope";
cin
Converted to subproject djx, removed dojo-typings
r65
export class FunctionRendition extends RenditionBase<Node> {
cin
added support for two arguments (props, children) form of fucntional components
r66 private _component: (...args: any[]) => any;
cin
Converted to subproject djx, removed dojo-typings
r65
private _node: Node | undefined;
cin
added support for two arguments (props, children) form of fucntional components
r66 constructor(component: (...args: any[]) => any) {
cin
Converted to subproject djx, removed dojo-typings
r65 super();
argumentNotNull(component, "component");
this._component = component;
}
cin
refactoring, adding scope to rendering methods
r96 protected _create(attrs: object, children: any[], scope: IScope) {
cin
Converted to subproject djx, removed dojo-typings
r65 const _attrs: any = attrs || {};
cin
refactoring, adding scope to rendering methods
r96 const _children = children.map(x => getItemDom(x, scope));
this._node = getItemDom(
this._component.call(null, { ..._attrs, children: _children }),
scope
cin
added support for two arguments (props, children) form of fucntional components
r66 );
cin
Converted to subproject djx, removed dojo-typings
r65 }
cin
added support for two arguments (props, children) form of fucntional components
r66 protected _getDomNode() {
cin
Converted to subproject djx, removed dojo-typings
r65 if (!this._node)
throw new Error("The instance of the widget isn't created");
return this._node;
}
}