ifandelse / machina.js

js ex machina - finite state machines in JavaScript
http://machina-js.org/
Other
1.93k stars 147 forks source link

Transitioned event should fire even if _onEnter not defined #137

Closed colegleason closed 6 years ago

colegleason commented 7 years ago

I use the "transitioned" even to watch for a successful transition. Some of my states do not need _onEnter functions, so this event does not fire. I currently just define an empty function in this case. It would be nice if the transitioned event fired regardless of _onEnter being defined, but always after _onEnter if it is defined.

radarfox commented 7 years ago

I agree, this is very confusing. So far I'm hotfixing this by defining _onEnter: _.noop in every state.

ifandelse commented 6 years ago

Thanks for reporting this @colegleason - apologies for the delay in getting back to you on it. I'll look at getting this patched.

ifandelse commented 6 years ago

This will go out with 2.0.1

joepie91 commented 6 years ago

Just a quick note: It seems that the changelog.md wasn't updated to reflect the recent 2.0.1 release :)

rniemeyer commented 6 years ago

@joepie91 - changelog.md updated. Thanks!

joepie91 commented 6 years ago

Appreciated, thanks :)