Files
KSP-MGA-Planner/dist/main/editor/buttons.js
Krafpy 824af087c1 Modified file structure.
Modified the file structure to have the `index.html` at the root
of the repository. Needed for Github Pages.
2021-08-15 21:31:25 +02:00

32 lines
632 B
JavaScript

class Button {
constructor(id) {
this._btn = document.getElementById(id);
}
enable() {
this._btn.disabled = false;
}
disable() {
this._btn.disabled = true;
}
}
export class SubmitButton extends Button {
constructor(id) {
super(id);
}
click(asyncAction) {
this._btn.onclick = async () => {
this.disable();
await asyncAction();
this.enable();
};
}
}
export class StopButton extends Button {
constructor(id) {
super(id);
}
click(action) {
this._btn.onclick = () => action();
}
}