The StateMachine class' executeOnce attribute effectively handles the on-enter behaviour of a state. However, it would also be nice to have somewhere to put code that needs executing on leaving a state, regardless of the state being transitioned to next. Maybe an executeLast attribute?
If you would like me to make a PR for this, please reply to this issue so I know whether this repo is being maintained or not.