mirror of
https://github.com/Krafpy/KSP-MGA-Planner.git
synced 2025-12-05 20:40:13 -08:00
Modified the file structure to have the `index.html` at the root of the repository. Needed for Github Pages.
32 lines
632 B
JavaScript
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();
|
|
}
|
|
}
|