@urso/core 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -27,6 +27,16 @@ class ModulesStatesManagerController {
|
|
|
27
27
|
|
|
28
28
|
_iteratorConstructor() {
|
|
29
29
|
let nextIndex = 0;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
const getNextStateByOrder = () => {
|
|
33
|
+
let statesArray = Object.keys(this._configStates);
|
|
34
|
+
|
|
35
|
+
if (nextIndex === statesArray.length)
|
|
36
|
+
nextIndex = 0;
|
|
37
|
+
|
|
38
|
+
return statesArray[nextIndex++];
|
|
39
|
+
}
|
|
30
40
|
|
|
31
41
|
return {
|
|
32
42
|
next: (() => {
|
|
@@ -36,7 +46,7 @@ class ModulesStatesManagerController {
|
|
|
36
46
|
if (this._currentState) {
|
|
37
47
|
const currentState = this._configStates[this._currentState];
|
|
38
48
|
|
|
39
|
-
if (
|
|
49
|
+
if (currentState.nextState) { //nextState: ["PICK_GAME2", "PICK_GAME1", "IDLE"]
|
|
40
50
|
for (const stateKey of currentState.nextState) {
|
|
41
51
|
if (this.checkStateGuard(stateKey)) {
|
|
42
52
|
nextIndex = statesArray.indexOf(stateKey) + 1;
|
|
@@ -52,11 +62,14 @@ class ModulesStatesManagerController {
|
|
|
52
62
|
}
|
|
53
63
|
}
|
|
54
64
|
|
|
55
|
-
//
|
|
56
|
-
|
|
57
|
-
nextIndex = 0;
|
|
65
|
+
//go next state by order
|
|
66
|
+
let stateName;
|
|
58
67
|
|
|
59
|
-
|
|
68
|
+
do {
|
|
69
|
+
stateName = getNextStateByOrder();
|
|
70
|
+
} while (!this.checkStateGuard(stateName));
|
|
71
|
+
|
|
72
|
+
return stateName;
|
|
60
73
|
}).bind(this)
|
|
61
74
|
}
|
|
62
75
|
}
|
|
@@ -71,10 +84,6 @@ class ModulesStatesManagerController {
|
|
|
71
84
|
let config = this._configStates[this._currentState];
|
|
72
85
|
let classInstance = this.getInstance('Helper').getActionByConfig(config);
|
|
73
86
|
|
|
74
|
-
//state guard
|
|
75
|
-
if (!this.checkStateGuard(this._currentState))
|
|
76
|
-
return this._nextState();
|
|
77
|
-
|
|
78
87
|
//actions instances guard
|
|
79
88
|
if (!classInstance.guard())
|
|
80
89
|
return this._nextState();
|