add switch
This commit is contained in:
parent
c40030a13e
commit
41c3ac5652
@ -48,7 +48,7 @@
|
||||
<span class="h2" style="margin-left: 10px;">Highscore: </span> <span class="h3" id="highScore" style="color: crimson;">0</span>
|
||||
<br>
|
||||
<br>
|
||||
<input type="checkbox" data-toggle="switchbutton" checked data-onlabel="Normal" data-offlabel="Hard Mode" data-onstyle="primary" data-offstyle="danger">
|
||||
<input id="modeSwitch" type="checkbox" data-toggle="switchbutton" checked data-onlabel="Normal" data-offlabel="Hard Mode" data-onstyle="primary" data-offstyle="danger">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-center">
|
||||
|
@ -21,6 +21,8 @@ class UI {
|
||||
|
||||
this.score = document.getElementById("score");
|
||||
this.highScore = document.getElementById("highScore");
|
||||
|
||||
document.getElementById("modeSwitch").addEventListener("change", (e:Event) => {this.switchMode(); this.nextRound()});
|
||||
}
|
||||
|
||||
async init() {
|
||||
@ -37,6 +39,10 @@ class UI {
|
||||
)
|
||||
}
|
||||
|
||||
switchMode() {
|
||||
this.model.switchMode();
|
||||
}
|
||||
|
||||
async buttonClick(btn: HTMLElement) {
|
||||
btn.setAttribute("disabled", "");
|
||||
let result = this.model.processClick(btn.innerText);
|
||||
|
Loading…
Reference in New Issue
Block a user