Tinder / StateMachine

A Kotlin and Swift DSL for finite state machine
Other
1.98k stars 128 forks source link

How can I implement timeout logic for state machine? #26

Open tianxu0836 opened 4 years ago

tianxu0836 commented 4 years ago

Some of the state will need a timeout to go to idle or something. How do you do that? Can somewhere give an example?

MaTriXy commented 4 years ago

Why not try adding a timer onEnter in each step and when timer is fired check if still in current state and transition it to the new state or idle as your logic requires.