This commit is contained in:
zadam
2020-01-18 18:01:16 +01:00
parent b25c1d6fa8
commit b00a9f4415
12 changed files with 91 additions and 102 deletions

View File

@@ -1,28 +1,20 @@
import Component from "./component.js";
class BasicWidget extends Component {
constructor(appContext) {
super(appContext);
this.widgetId = `widget-${this.constructor.name}`;
}
renderTo($parent) {
this.$parent = $parent;
$parent.append(this.render());
}
render() {
// actual rendering is async
this.$widget = this.doRender();
// $widget.attr('id', this.widgetId);
return this.$widget;
return this.doRender();
}
/**
* for overriding
*/
doRender() {}
async doRender() {}
toggle(show) {
this.$widget.toggle(show);