-
Notifications
You must be signed in to change notification settings - Fork 1
/
Result.js
61 lines (47 loc) · 1.29 KB
/
Result.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
class Result {
constructor(timeValue = null, time = null, actions = null, difficulty = null, playerName = '') {
if (!(time || actions))
throw new Error("You have to set time and actions properties");
this._time = time;
this._actions = actions;
this._playerName = playerName ? playerName : 'anonim';
this._timeValue = timeValue;
this._difficulty = difficulty;
}
get time() {
return this._time;
}
set time(time) {
if (!time)
throw new Error("You have to set time property");
return this._time = time;
}
get actions() {
return this._actions;
}
set actions(actions) {
if (!actions)
throw new Error("You have to set actions property");
return this._actions = actions;
}
get playerName() {
return this._playerName;
}
set playerName(playerName) {
return this._playerName = playerName ? playerName : 'anonim';
}
get difficulty() {
return this._difficulty;
}
set difficulty(difficulty) {
if (!difficulty)
throw new Error("You have to set difficulty property");
return this._difficulty = difficulty;
}
get timeValue() {
return this._timeValue
}
set timeValue(value) {
return this._timeValue = value;
}
}