redefine project

This commit is contained in:
p-wojt
2021-12-31 21:42:08 +01:00
parent 656e157f14
commit 9649216920
12 changed files with 359 additions and 154 deletions

39
src/model/counter.ts Normal file
View File

@@ -0,0 +1,39 @@
export class Counter {
static value: number;
min: number;
max: number;
constructor(min: number, max: number){
Counter.value = min;
this.min = min;
this.max = max;
}
increment(){
if(!this.isMax()){
Counter.value++;
return true;
}
return false;
}
decrement(){
if(!this.isMin()){
Counter.value--;
return true;
}
return false;
}
clear(){
Counter.value = 0;
}
private isMax(){
return this.max === Counter.value;
}
private isMin(){
return this.min === Counter.value;
}
}

11
src/model/item.ts Normal file
View File

@@ -0,0 +1,11 @@
export class Item {
id: number;
name: string;
color: string;
constructor(id: number, name: string, color: string){
this.id = id;
this.name = name;
this.color = color;
}
}