football-scoreboard
Version:
A live football World Cup scoreboard library.
22 lines (21 loc) • 644 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Match = void 0;
const constants_1 = require("./constants");
class Match {
constructor(homeTeam, awayTeam) {
this.homeTeam = homeTeam;
this.awayTeam = awayTeam;
this.homeScore = 0;
this.awayScore = 0;
this.startTime = Date.now();
}
updateScore(newHomeScore, newAwayScore) {
if (newHomeScore < 0 || newAwayScore < 0) {
throw new Error(constants_1.ERROR_NEGATIVE_SCORE);
}
this.homeScore = newHomeScore;
this.awayScore = newAwayScore;
}
}
exports.Match = Match;