-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame_script.js
37 lines (30 loc) · 1.11 KB
/
game_script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { Model } from "./game_model.js";
import { View } from "./game_view.js";
import { Controller } from "./game_controller.js";
window.addEventListener("load", async () => {
let model = new Model();
let view = new View(model);
let controller = new Controller(model, view);
let body = document.querySelector('body');
body.append(view.div);
// API choice buttons.
document.getElementById("cat_button").addEventListener("click", () => {
view.insertFactClickHandler(1);
view.showDataView();
});
document.getElementById("dog_button").addEventListener("click", () => {
view.insertFactClickHandler(2);
view.showDataView();
});
document.getElementById("face_button").addEventListener("click", () => {
view.insertFactClickHandler(3);
view.showDataView();
});
document.getElementById("random_button").addEventListener("click", () => {
view.insertFactClickHandler(4);
view.showDataView();
});
document.getElementById("reset_button").addEventListener("click", () => {
view.restartClickHandler();
});
});