Skip to content

Commit 3e131d5

Browse files
committed
Ability to add a new State from an existing State implemented
Stress tested up to 100 states all running together.
1 parent 8eccfc8 commit 3e131d5

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

v3/src/checksum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
var CHECKSUM = {
2-
build: 'adba6db0-665c-11e7-bbcf-6f306cfc2eb0'
2+
build: '301d58e0-6661-11e7-a646-9f2c5eee0a48'
33
};
44
module.exports = CHECKSUM;

v3/src/plugins/StateManager.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ var StateManager = new Class({
3939

4040
switch (action.type)
4141
{
42+
case 'add':
43+
manager.add(action.key, action.data, action.autoStart);
44+
break;
45+
4246
case 'start':
4347
manager.stop(this.key);
4448
manager.start(action.key, action.data);
@@ -107,6 +111,14 @@ var StateManager = new Class({
107111
return this;
108112
},
109113

114+
// Add the State into the State Manager and start it if 'autoStart' is true or the State config 'active' property is set
115+
add: function (key, stateConfig, autoStart)
116+
{
117+
this._queue.push({ type: 'add', key: key, data: stateConfig, autoStart: autoStart });
118+
119+
return this;
120+
},
121+
110122
// Launch the given State and run it in parallel with this one
111123
launch: function (key, data)
112124
{

0 commit comments

Comments
 (0)