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

Can you publish to the toState property of Transition class? #22

Open
kwmt opened this issue Sep 12, 2019 · 0 comments
Open

Can you publish to the toState property of Transition class? #22

kwmt opened this issue Sep 12, 2019 · 0 comments

Comments

@kwmt
Copy link

kwmt commented Sep 12, 2019

Because I want to determine the action according to the toState state.
If you can I can create an extension function then I can write to flow.

ex)

If toState property is publish and you define below extension

fun State.navigate() {
  when(this) {
     Solid -> foo
  }
}

we can write the following:

stateMachine.transition(<SomeEvent>).toState.navigate()

Now we can only write the following:

stateMachine.run {
    transition(it)
    state.navigate()
}

Thank you.

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

1 participant