##// END OF EJS Templates
added 'dom-inject' and 'css' modules
added 'dom-inject' and 'css' modules

File last commit:

r3:fb4d13ff05ae default
r6:5cc84d1fc7c0 default
Show More
WidgetContext.ts
43 lines | 1.2 KiB | video/mp2t | TypeScriptLexer
/ src / main / ts / djx / WidgetContext.ts
cin
Initial commit, copied files related to .tsx scripts support.
r0 import dom = require("dojo/dom-construct");
cin
created typings for basic part of dojo and dijit further work is required to...
r2 import { argumentNotNull } from "@implab/core-amd/safe";
cin
Initial commit, copied files related to .tsx scripts support.
r0 import _WidgetBase = require("dijit/_WidgetBase");
import { BuildContextBase } from "./BuildContextBase";
cin
fixed dependencies
r3
type _WidgetBaseConstructor = typeof _WidgetBase;
cin
Initial commit, copied files related to .tsx scripts support.
r0
export class WidgetContext extends BuildContextBase {
widgetClass: _WidgetBaseConstructor;
cin
typescript strict mode...
r1 _instance: _WidgetBase | undefined;
cin
Initial commit, copied files related to .tsx scripts support.
r0
constructor(widgetClass: _WidgetBaseConstructor) {
super();
argumentNotNull(widgetClass, "widgetClass");
this.widgetClass = widgetClass;
}
_addChild(child: any): void {
cin
typescript strict mode...
r1 if (!this._instance || !this._instance.containerNode)
cin
Initial commit, copied files related to .tsx scripts support.
r0 throw new Error("Widget doesn't support adding children");
dom.place(this.getChildDom(child), this._instance.containerNode);
}
_setAttrs(attrs: object): void {
cin
typescript strict mode...
r1 this._instance?.set(attrs);
cin
Initial commit, copied files related to .tsx scripts support.
r0 }
_create(attrs: object, children: any[]) {
this._instance = new this.widgetClass(this._attrs);
if (children)
children.forEach(x => this._addChild(x));
}
_getDomElement() {
cin
typescript strict mode...
r1 if (!this._instance)
throw new Error("The instance of the widget isn't created");
cin
Initial commit, copied files related to .tsx scripts support.
r0 return this._instance.domNode;
}
}