-
Notifications
You must be signed in to change notification settings - Fork 3
(update) added event argument hitchhiking #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Lol it's absurd how long ago you submitted this, and I just saw it now. Gonna have to ask Github to work out their notifications, I'm on this site every day. |
| states[name] = states[name] || function () { | ||
| states.trigger(name); | ||
| var args = Array.prototype.slice.call(arguments); | ||
| var arr = args.sort(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this sort call? This is really unexpected in my experience, I'd expect the order or arguments to never change?
| me.onChange(me.currentState(), prev.name); | ||
| is(currentState.enter, 'Function') && currentState.enter(); | ||
| me.onChange(me.currentState(), prev.name, args); | ||
| args.push(me.currentState()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why put the current state at the end of the list of arguments? Wouldn't it be more predictable to have the current state as the first argument?
| ; | ||
|
|
||
| newStates.withParams('a string', {some: 'data'}); | ||
| q.equal(_in1, 'a string'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These specs are failing for me: https://cl.ly/2C283C1l1w2y
|
Curious if you're using these changes in production anywhere? |
For this fine state machine to be compatible with our envisioned payment workflow implementation, I need to be able to update our database inside the stateMachine itself. With this change we can add arguments to the event method and use them in the enter phase of the state change. See test for implementation