launcher improvements

This commit is contained in:
zadam
2022-12-02 16:46:14 +01:00
parent 7b36709e18
commit b85f335561
17 changed files with 283 additions and 196 deletions

View File

@@ -0,0 +1,22 @@
import AbstractButtonWidget from "./abstract_button.js";
export default class OnClickButtonWidget extends AbstractButtonWidget {
doRender() {
super.doRender();
if (this.settings.onClick) {
this.$widget.on("click", e => {
this.$widget.tooltip("hide");
this.settings.onClick(this, e);
});
} else {
console.warn(`Button widget '${this.componentId}' has no defined click handler`, this.settings);
}
}
onClick(handler) {
this.settings.onClick = handler;
return this;
}
}