fix-countjs-import #1

Merged
Schmidii99 merged 2 commits from fix-countjs-import into main 2023-04-12 12:36:21 +02:00
3 changed files with 13 additions and 6 deletions
Showing only changes of commit dc825ec1cd - Show all commits

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.DS_Store

View File

@ -11,8 +11,6 @@
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
</head>
<body>
<script src="game.js"></script>
<div>
<nav class="navbar navbar-expand-sm bg-light navbar-light">
<div class="container-fluid h4">
@ -53,9 +51,9 @@
<span class="h3">cpu score:</span>
<span class="h3 counter-count" id="nextCpuScore">?</span>
<br>
<button class="btn btn-lg bg-info m-3" onclick="btnHigherClick()" id="btnHigher">Higher</button>
<button class="btn btn-lg bg-info m-3" id="btnHigher">Higher</button>
<br>
<button class="btn btn-lg bg-info mb-3" onclick="btnLowerClick()" id="btnLower">Lower</button>
<button class="btn btn-lg bg-info mb-3" id="btnLower">Lower</button>
</div>
</div>
</div>
@ -63,5 +61,11 @@
<!-- <div class="footer">
<a href="https://www.flaticon.com/free-icons/processor" title="processor icons">Processor icons created by kerismaker - Flaticon</a>
</div> -->
<script type="module">
import {btnHigherClick, btnLowerClick} from "./game.js"
document.getElementById("btnHigher").onclick = btnHigherClick
document.getElementById("btnLower").onclick = btnLowerClick
</script>
</body>
</html>

View File

@ -1,3 +1,5 @@
import { CountUp } from "./node_modules/countup.js/dist/countUp.min.js";
var cpuList;
var currentCpu;
var nextCpu;
@ -18,11 +20,11 @@ function getRandomCpu() {
}
}
function btnLowerClick() {
export function btnLowerClick() {
currentCpu.score < nextCpu.score ? showResult(true) : showResult(false);
}
function btnHigherClick() {
export function btnHigherClick() {
currentCpu.score > nextCpu.score ? showResult(true) : showResult(false);
}