question: callback naming convention
Closed this issue · 6 comments
All callbacks begin with on
and must be lowercase, correct?
Is there a reason they must be named this way? Can the on
prefix be entirely eliminated?
Only the on{leave|enter|entered}
part has to be lowercase.
The reason is like this is because my initial state machines were implemented using javascript-state-machine, therefore the convention for the callbacks was inherited from there.
Looks like we might get rid of the on
prefix. I was planning some other changes that are backward incompatible, so it might be a good idea to gather them into a new issue so that we can bundle those features into 1.0.0 version.
👍 for ditching on
. If we can get rid of on
, it appears we can also support camelCase, right? enterSomething
, leaveSomething
, etc. Could still just use lowercase for the internal representation...
Getting rid of on
is straightforward but breaking change, as current fsm implementations use on for callbacks.
Did not get the comment about "internal representations"...
The new implementation allows to define a callback prefix property as part of the static object. By default tits value would be on
for backwards compatibility but you can change it to something like ''
.
Would that be enough for you?