-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
46 lines (42 loc) · 1015 Bytes
/
Copy pathmain.js
File metadata and controls
46 lines (42 loc) · 1015 Bytes
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
38
39
40
41
42
43
44
45
46
import MemoryGame from "./game.js";
const gameContainer = document.querySelector(".memory-game");
const cardsSelect = document.getElementById("cards");
const backFace = "img/js-badge.svg";
const cardsData = [
{
framework: "aurelia",
frontFace: "img/aurelia.svg",
},
{
framework: "vue",
frontFace: "img/vue.svg",
},
{
framework: "angular",
frontFace: "img/angular.svg",
},
{
framework: "backbone",
frontFace: "img/backbone.svg",
},
{
framework: "ember",
frontFace: "img/ember.svg",
},
{
framework: "react",
frontFace: "img/react.svg",
},
];
const memoryGame = new MemoryGame(
gameContainer,
backFace,
cardsData,
cardsSelect
);
memoryGame.init();
// Event listeners for the buttons
const updateButton = document.getElementById("btn");
updateButton.addEventListener("click", () => memoryGame.updateCards());
const newGameBtn = document.getElementById("newGameBtn");
newGameBtn.addEventListener("click", () => memoryGame.resetGame());