Conditional Transitions with asynchronous function
AdrianCuartas opened this issue · comments
Is it possible?
I tried in a different ways but I always get an error.
I need to do something like this:
states: A, B and C.
transition: step.
From state A, 'step' transition must be a function which returns B or C depending on asynchronous operation.
var fsm = new StateMachine({
init: 'A',
transitions: [
{ name: 'step',
from: 'A',
to: async function() {
var state = await getState()
return state
}
}
]
});
Thanks in advance.
I could try to file a PR for this. Any concerns @jakesgordon ?