add reset method
This commit is contained in:
parent
1c4dfdad00
commit
38e9e848fd
@ -8,8 +8,7 @@ export class CpuRepository {
|
|||||||
const fetchResult = await fetch("../data.json");
|
const fetchResult = await fetch("../data.json");
|
||||||
this.#cpuList = await fetchResult.json();
|
this.#cpuList = await fetchResult.json();
|
||||||
|
|
||||||
this.#currentCPU = this.getRandomCpu();
|
this.reset();
|
||||||
this.#nextCPU = this.getRandomCpu();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get currentCpu() {
|
get currentCpu() {
|
||||||
@ -39,4 +38,9 @@ export class CpuRepository {
|
|||||||
this.#currentCPU = this.#nextCPU
|
this.#currentCPU = this.#nextCPU
|
||||||
this.#nextCPU = this.getRandomCpu();
|
this.#nextCPU = this.getRandomCpu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reset(): void {
|
||||||
|
this.#currentCPU = this.getRandomCpu();
|
||||||
|
this.#nextCPU = this.getRandomCpu();
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user