looplab / fsm

Finite State Machine for Go
Apache License 2.0
2.86k stars 312 forks source link

Context in event handlers #61

Closed ilyakaznacheev closed 2 years ago

ilyakaznacheev commented 4 years ago

It would be great to add a context to event trigger function and event handler function signature because it is required in many operations.

Probably it will require to double the methods (i.e. fsm.EventContext(ctx, event, args...) and type CallbackContext func(ctx, *Event).

maxekman commented 3 years ago

Good suggestion! Will look into it when I have some time.

ilyakaznacheev commented 2 years ago

👏