Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional Transitions with asynchronous function #156

Open
AdrianCuartas opened this issue Apr 23, 2018 · 1 comment
Open

Conditional Transitions with asynchronous function #156

AdrianCuartas opened this issue Apr 23, 2018 · 1 comment

Comments

@AdrianCuartas
Copy link

AdrianCuartas commented Apr 23, 2018

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.

@ulich
Copy link

ulich commented Mar 4, 2019

I could try to file a PR for this. Any concerns @jakesgordon ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants