mdeloof / statig

Hierarchical state machines for designing event-driven systems
https://crates.io/crates/statig
MIT License
560 stars 18 forks source link

After dispatch hook #23

Open dragonnn opened 2 months ago

dragonnn commented 2 months ago

Although on_dispatch and on_transition hook are intend to be used for loging in some cases it can be useful to abuse them to have a global even handler that stores some filtered events in self. For that case it sometimes makes sense to be able to store something in self after a state handler is called to for example use it for storing previous values that can be used when a new value comes in to compare too.