javascript-state-machine
javascript-state-machine copied to clipboard
Add transitions after calling constructor
Is there a way to add new transitions/states after the first call to the constructor?
I have tried doing this
fsm._fsm.config.mapTransition({
name: "startPause",
from: "game",
to: "pause"
});
but I get a fsm.startPause is not a function error.
Check out this codepen for my test Thanks!
Not sure why you would want to do this -- the whole idea of a 'finite state' machine is that there are a finite number of possible states. Adding states/transitions dynamically kinda breaks that paradigm...