mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 11:56:01 +01:00
continuing refactoring
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user