Skip to content
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

why some method has no async callback parameter? #410

Open
fawdlstty opened this issue Dec 18, 2020 · 6 comments
Open

why some method has no async callback parameter? #410

fawdlstty opened this issue Dec 18, 2020 · 6 comments

Comments

@fawdlstty
Copy link

I find some method has no async callback parameter such as PermitDynamic, PermitDynamicIf, etc. but some method has async callback parameter, such as OnEntryAsync, OnEntryFromAsync, etc.

why no PermitDynamicAsync, PermitDynamicIfAsync method to use?

@HenningNT
Copy link
Contributor

I think there are two explanations: The Async side of the library have not been prioritized, and a lack of interest, i.e. we only add the bits that people ask for.

At the moment I'd rather not add more methods, but use a more "fluent" configuration:

sm.Configure(State.A)
    .Permit(Trigger.Z, State.B).Do(SomeAction)
    .Permit(Trigger.T).Internal().If(SomeCondition).Do(SomeAction)
    .Permit(Trigger.S).Self().Do(SomeAction)
    .Permit(Trigger.R).Self().If(SomeCondition).Do(SomeAction)
    .Permit(Trigger.S).Self().Do(SomeAction)

There wouldn't be any Async, only the Actions that would be called would be async. The only method with Async in its name would be FireAsync. I gave it a go in PR #369, but haven't merged it yet, I'm not sure if I have time to support it.

@md-gh
Copy link

md-gh commented Dec 19, 2020

Maybe I can help develop stateless ?

@HenningNT
Copy link
Contributor

Sure thing!
We are always open to pull requests :-)

@aalivingston
Copy link

+1, I have need for PermitDynamicAsync on a project. Might look at submitting a PR, if I have some spare available time.

@fawdlstty
Copy link
Author

At the moment I'd rather not add more methods, but use a more "fluent" configuration:

I developed a similar project SMLite, which prove the perfect support asynchronous still can realize "fluent" configuration at the same time, perhaps can give you refer to

@HenningNT
Copy link
Contributor

Time is a limited resource :-)
I'd like to change the API to a even more fluent design, but don't have the time. ...and I'm afraid that the switch will be uncomfortable to Stateless users, as all state machines will have to be changed.

@aalivingston If you want to submit a PR then please feel free to do so!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants