From 38e9e848fd5c1dce715ec70a24dd28d0b90f264f Mon Sep 17 00:00:00 2001 From: Florian Schmid Date: Sat, 22 Apr 2023 19:36:12 +0200 Subject: [PATCH] add reset method --- src/cpuRepository.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cpuRepository.ts b/src/cpuRepository.ts index dd55519..2d4eb7f 100644 --- a/src/cpuRepository.ts +++ b/src/cpuRepository.ts @@ -8,8 +8,7 @@ export class CpuRepository { const fetchResult = await fetch("../data.json"); this.#cpuList = await fetchResult.json(); - this.#currentCPU = this.getRandomCpu(); - this.#nextCPU = this.getRandomCpu(); + this.reset(); } get currentCpu() { @@ -39,4 +38,9 @@ export class CpuRepository { this.#currentCPU = this.#nextCPU this.#nextCPU = this.getRandomCpu(); } + + reset(): void { + this.#currentCPU = this.getRandomCpu(); + this.#nextCPU = this.getRandomCpu(); + } } \ No newline at end of file