ztellman / automat

better automata through combinators

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

timeout example

happy-lisper opened this issue · comments

While I think I know how I would do that (via reducer functions), I am looking for a recommendation how to achieve timeout transitions.

optimally, timeout supports would be in the library though

The automata advancement doesn't block, I'm not sure how a timeout would fit into the library. Typically a timeout would be a signal, which may or may not be a valid signal depending on whether the event has already occurred.

I realize that an automata advancement does not block, and of course timers would be managed outside of the library. However, in my case, I deal with different timeouts for different states and have a need to somehow create those timers, e.g. using overtone/at-at and manage them depending on states. Also, in case the timer does not trigger, I need to be able to cancel it. In some cases I might need to set two timers causing different signals, one longer for entire operation, another shorter for some sub-state. In another words, I need to tell what state I am in, and in that sense I would need a support from the library. I initially though to use reducer functions, but now see it will not work.

Closing, as this is out of scope for this library.