import { Controller } from "https://unpkg.com/@hotwired/stimulus/dist/stimulus.js";
export class WelcomeController extends Controller {
static targets = ["simpleHighScores"];
connect() {
this._buildHighScores();
}
startGame(ev) {
ev.preventDefault();
this.element.classList.add('hidden');
window.dispatchEvent(new CustomEvent("startCountdown"));
}
gameEnded(ev) {
this.element.classList.remove('hidden');
}
_buildHighScores() {
let scores = {
last: 12,
high: 10,
streak: 3
};
let newEls = [
`đ ${scores.last}`,
`đĨ ${scores.streak}`,
`âŠī¸ ${scores.high}`
];
this.simpleHighScoresTarget.innerHTML = newEls.join('');
}
}