spoike/refluxjs — pull request #103 by lud (2014-10-24 14:23:03+00:00)
Title: Added possibility to add async code into actios

Hi,

I like to handle Web APIs into the actions code. I thought this possibility was missing there, so I added it.

Basically there's a new hook that can do async work and then trigger the action for real. It's cool because it allows to hide asynchrony into the action. Good to develop module consisting of several actions working with a same API. I like to think actions modules as interfaces, so i think web API calls belong there.

Still, if you do not implement the hook, or use it to do someting else, you can contitue to do AJAX work into stores or wherever you like, the behavior of Reflux is not changed if you do not use this new hook.

I've added a test case too. There was a test failing before my changes, it's still failing (of course) but I've not broken anything.

I updated the readme according to my changes.

I think we may use a promise, but i do not think adding ES6 as a dependency is a good move at this point. So i didn't.

Finally, i think that the name I choose, `handleCall`, is far from perfect. But i couldn't come up with something better, as often.

Thanks for reading an considering this PR.