SCION-CORE
SCION-CORE copied to clipboard
bug history state (again?)
The state machine below does not work. We may however note that the bug is only present at the first time we re-enter A via a self-transition. The second time and next times, the state machine remembers well the prior active substate...
var sm = new scion.Statechart({ states: [ { id: 'A', transitions: [ { event: 'x', target: 'A' } ], states: [ { id: 'H', $type: 'history', transitions: [ { target: 'A1' } ] }, { id: 'A1', transitions: [ { event: 'y', target: 'A2' } ] }, { id: 'A2' } ] } ] });
sm.start(); //alert('Current: ' + sm.getConfiguration()[0]); // A1 -> OK sm.gen('y'); //alert('Current: ' + sm.getConfiguration()[0]); // A2 -> OK sm.gen('x'); // Self-transition alert('Current (BUG): ' + sm.getConfiguration()[0]); // A2 expected but A1, why? sm.gen('x'); // Self-transition alert('Current: ' + sm.getConfiguration()[0]); // A2! This works the second time only?