continuing refactoring

This commit is contained in:
zadam
2020-01-15 21:36:01 +01:00
parent f98a20928c
commit 7963de0abc
12 changed files with 138 additions and 118 deletions

View File

@@ -1,9 +1,8 @@
class BasicWidget {
/**
* @param {AppContext} appContext
*/
import Component from "./component.js";
class BasicWidget extends Component {
constructor(appContext) {
this.appContext = appContext;
super(appContext);
this.widgetId = `widget-${this.constructor.name}`;
}
@@ -25,20 +24,6 @@ class BasicWidget {
*/
doRender() {}
eventReceived(name, data) {
console.log("received", name, "to", this.widgetId);
const fun = this[name + 'Listener'];
if (typeof fun === 'function') {
fun.call(this, data);
}
}
trigger(name, data) {
this.appContext.trigger(name, data);
}
toggle(show) {
this.$widget.toggle(show);
}