Add change function
parent
24e5650f09
commit
f8f4c555b8
|
@ -15,6 +15,12 @@ class State {
|
||||||
return this.states.set(key, value);
|
return this.states.set(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
change(key, amount = 1) {
|
||||||
|
let val = this.get(key, 0);
|
||||||
|
val += amount;
|
||||||
|
this.set(key, val);
|
||||||
|
}
|
||||||
|
|
||||||
serialize() {
|
serialize() {
|
||||||
const entries = this.states.entries();
|
const entries = this.states.entries();
|
||||||
const entrymap = [];
|
const entrymap = [];
|
||||||
|
|
Loading…
Reference in New Issue