Additional data can be used when getting the state for a transition #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi there,
First of all props for the amazing library! It works perfectly with states as string. But in my use case, I would like to store some additional data alongside the state of the object like the datetime of when the object has transitioned to state.
To store such information, I made the state an entity instead of a string. And by overriding the new
getStateForTransition
method in my own StateMachine class, I can return an object instead of a string. To add data to the state object, you can pass an additional array.Hopefully you'll like the idea :-) otherwise you have some thoughts how I can resolve this with your library.