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

Add async counter example #149

Merged
merged 13 commits into from
Jul 18, 2016
Merged

Add async counter example #149

merged 13 commits into from
Jul 18, 2016

Conversation

sotojuan
Copy link
Contributor

@sotojuan sotojuan commented Jul 9, 2016

This is a common example in React/Redux world so it'd be nice to have it for comparison's sake.

In the future I'd like to be able to "cancel" an async increment/decrement such that if the async increment button is clicked, then the cancel button is clicked before the timeout ends, send('increment', done) is never called and nothing happens.

},
effects: {
incrementAsync: function (data, state, send, done) {
setTimeout(() => send('increment', done), 1000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey I think you meant to put done as the third param here. The second param is for data, which can be null in this case.

Copy link
Member

@yoshuawuyts yoshuawuyts Jul 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is valid too; data is optional so is set to null if not passed.

Ref in barracks codebase

@yoshuawuyts
Copy link
Member

yoshuawuyts commented Jul 10, 2016

LGTM 🎉

@sotojuan
Copy link
Contributor Author

Thanks, @yoshuawuyts feel free to squash and merge when you can :-)

@yoshuawuyts
Copy link
Member

@sotojuan looks like with the master branch guards, I can't squash and merge - could you squash the commits and force push so I can merge? Thanks! 😁

@sotojuan
Copy link
Contributor Author

Hey @yoshuawuyts not sure if I did it correctly—I don't mind just closing this PR and submitting another one lol. Really bad at Git.

@sotojuan
Copy link
Contributor Author

@yoshuawuyts Let me know if you can merge ASAP because IDK what I am doing w/ the Git history/rebase anymore ha. Otherwise I don't mind closing and redoing a PR again.

@yoshuawuyts
Copy link
Member

hah cool yeah let's merge (':

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

Successfully merging this pull request may close these issues.

3 participants