KStateMachine / kstatemachine

KStateMachine is a powerful Kotlin Multiplatform library with clean DSL syntax for creating complex state machines and statecharts driven by Kotlin Coroutines.
https://kstatemachine.github.io/kstatemachine/
Boost Software License 1.0
358 stars 21 forks source link

Listen to group of states or transitions #11

Closed nsk90 closed 2 years ago

nsk90 commented 3 years ago

Sometimes it might be useful to listen to group of states. For example you have 3 states. When your are in 1 you set some flag. Then you go to 2 and then to 3. In 3 flag is dismissed (successful result). But what if state 2 have transitions to another states. We might want to dismiss flag if state machine goes in wrong direction. To solve this problem group of states, nested states or transition path might be useful.

nsk90 commented 2 years ago

Done in https://github.com/nsk90/kstatemachine/releases/tag/v0.11.1

with onActiveAllOf() / onActiveAnyOf()