UNPKG

468 BJavaScriptView Raw
1export default class State {
2 constructor(map) {
3 this.states = 0;
4 this.map = map;
5 }
6 add(state) {
7 this.states |= state;
8 }
9 delete(state) {
10 this.states &= ~state;
11 }
12 toggle(state) {
13 if (this.has(state)) {
14 this.delete(state);
15 }
16 else {
17 this.add(state);
18 }
19 }
20 has(state) {
21 return !!(this.states & state);
22 }
23}
24//# sourceMappingURL=state.js.map
\No newline at end of file