@urso/core 0.7.39 → 0.7.41
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
|
@@ -7,6 +7,7 @@ class ModulesStatesManagerAction {
|
|
|
7
7
|
this._terminating = false;
|
|
8
8
|
this.finished = false;
|
|
9
9
|
this._onFinishCallback = false;
|
|
10
|
+
this._startTime = 0;
|
|
10
11
|
|
|
11
12
|
this._onFinish = this._onFinish.bind(this);
|
|
12
13
|
}
|
|
@@ -18,6 +19,7 @@ class ModulesStatesManagerAction {
|
|
|
18
19
|
|
|
19
20
|
run(onFinishCallback) {
|
|
20
21
|
this._running = true;
|
|
22
|
+
this._startTime = Urso.time.get();
|
|
21
23
|
log(`%c action run ---> ${this.name}`, 'color: blue');
|
|
22
24
|
|
|
23
25
|
this.emit(Urso.events.MODULES_STATES_MANAGER_ACTION_START, this.name);
|
|
@@ -57,10 +59,11 @@ class ModulesStatesManagerAction {
|
|
|
57
59
|
this._running = false;
|
|
58
60
|
this._terminating = false;
|
|
59
61
|
this.finished = true;
|
|
62
|
+
const elapsedTime = Urso.time.get() - this._startTime;
|
|
60
63
|
|
|
61
64
|
this.emit(Urso.events.MODULES_STATES_MANAGER_ACTION_FINISH, this.name);
|
|
62
65
|
|
|
63
|
-
log(`%c action finish <--- ${this.name}`, 'color: blue');
|
|
66
|
+
log(`%c action finish <--- ${this.name} (${elapsedTime}ms)`, 'color: blue');
|
|
64
67
|
this._onFinishCallback();
|
|
65
68
|
}
|
|
66
69
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
class ModulesStatesManagerController {
|
|
2
|
+
|
|
2
3
|
constructor() {
|
|
3
4
|
this.singleton = true;
|
|
4
5
|
|
|
@@ -66,14 +67,16 @@ class ModulesStatesManagerController {
|
|
|
66
67
|
|
|
67
68
|
return {
|
|
68
69
|
next: (() => {
|
|
70
|
+
let statesArray = Object.keys(this._configStates);
|
|
71
|
+
|
|
72
|
+
//force next state
|
|
69
73
|
if (this._forceNextStateKey) {
|
|
70
74
|
const forceNextStateKey = this._forceNextStateKey;
|
|
71
75
|
this._forceNextStateKey = null;
|
|
76
|
+
nextIndex = statesArray.indexOf(forceNextStateKey) + 1;
|
|
72
77
|
return forceNextStateKey;
|
|
73
78
|
}
|
|
74
79
|
|
|
75
|
-
let statesArray = Object.keys(this._configStates);
|
|
76
|
-
|
|
77
80
|
//nextState
|
|
78
81
|
if (this._currentState) {
|
|
79
82
|
const currentState = this._configStates[this._currentState];
|
|
@@ -173,7 +176,9 @@ class ModulesStatesManagerController {
|
|
|
173
176
|
}
|
|
174
177
|
|
|
175
178
|
checkStateGuard = (key) => {
|
|
176
|
-
|
|
179
|
+
const guardResult = this.statesGuards.checkGuard(key);
|
|
180
|
+
log('%c State guard ' + key + ' is ' + guardResult, 'background: #DA55C4; color: #000')
|
|
181
|
+
return guardResult;
|
|
177
182
|
}
|
|
178
183
|
|
|
179
184
|
removeStateGuard = (key, guard) => {
|
|
@@ -182,4 +187,4 @@ class ModulesStatesManagerController {
|
|
|
182
187
|
|
|
183
188
|
}
|
|
184
189
|
|
|
185
|
-
module.exports = ModulesStatesManagerController;
|
|
190
|
+
module.exports = ModulesStatesManagerController;
|
|
@@ -28,6 +28,7 @@ class ModulesStatesManagerRace extends Action {
|
|
|
28
28
|
log(`%c action run ---> ${this.name}`, 'color: orange', this.params);
|
|
29
29
|
|
|
30
30
|
this.finished = false;
|
|
31
|
+
this._startTime = Urso.time.get();
|
|
31
32
|
this._onFinishCallback = onFinishCallback;
|
|
32
33
|
|
|
33
34
|
for (let action of this._actions)
|
|
@@ -67,7 +68,8 @@ class ModulesStatesManagerRace extends Action {
|
|
|
67
68
|
|
|
68
69
|
_onFinish() {
|
|
69
70
|
this.finished = true;
|
|
70
|
-
|
|
71
|
+
const elapsedTime = Urso.time.get() - this._startTime;
|
|
72
|
+
log(`%c action finish <--- ${this.name} (${elapsedTime}ms)`, 'color: orange');
|
|
71
73
|
this._onFinishCallback();
|
|
72
74
|
}
|
|
73
75
|
}
|