StateMachine icon indicating copy to clipboard operation
StateMachine copied to clipboard

Can you publish to the `toState` property of `Transition` class?

Open kwmt opened this issue 5 years ago • 0 comments

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.

kwmt avatar Sep 12 '19 09:09 kwmt