-
Notifications
You must be signed in to change notification settings - Fork 29
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
PermitIf + Parameterized triggers #26
Comments
I agree. Not being able to pass the argument to the predicate makes no sense and makes using this library much harder and more complicated. |
This is actually a consequence of a larger problem. The proposed overload such as the above will make for very unclean calls (filled with complicated parameters, and arguments), and will end up in a convoluted mess. This requires an API redesign to have a semantically correct API. I was waiting for someone to point this out. I didn't want to differ much from the general pattern of What I had in mind is to use an complete new This should result in clean code, as well making the intent of arguments very clear. |
@tastyeggs - This is something that I'd like to work on. However I'm not sure I'll get the time to this in the next few days. So, might take a while. Meanwhile, I understand there is a need. So, I'll be happy to take in any PRs into the |
Thanks Prasanna. That would be great. On Sat, Feb 27, 2016 at 8:08 PM, Prasanna V. Loganathar <
Alex |
PermitIf must expose the trigger parameter in its predicate for them to be useful. Since config lacks context (as I want to make that a singleton throughout my app), I'm trying to pass in context as a trigger parameter, and would like to add guard conditions that involve this context.
Would suggest an overload such as this:
PermitIf<TArgument>(Func<TArgument,Task<bool>> predicate, ParameterizedTrigger<TTrigger, TArgument> trigger, TState resultingState, Action<Transition<TState, TTrigger>, TArgument> onTriggerAction)
The text was updated successfully, but these errors were encountered: