These are chat archives for reflux/refluxjs

19th
May 2015
shalomeir
@shalomeir
May 19 2015 06:35
I made this react news sample demo program (http://snippod-boilerplate-dev.elasticbeanstalk.com/) using reflux. This is based on evan's react news which is linked at reflux readme. I hesitate that where I ajax call and how to do that async. It's not difficult but It's hard for me like JavaScript begginer. Also I used only trigger() not trigger(something) to emit to react component. Because when Component received a event from Store, component could be get a data from store again, and this is more easy to me. I didn't know this is a standard way but I couldn't find any source like full interaction example code using reflux. So I decided my own way.
This is my first shared git repo. (https://github.com/shalomeir/snippod-boilerplate) So, I'm not sure about some point. Any feedback plz~ :)
Peter Nguyen
@pengux
May 19 2015 07:00
How do you implement singleton instances such as websocket connection so it can be used by the stores to get data in reflux?
shalomeir
@shalomeir
May 19 2015 07:32
I made a utility program using Promise (https://github.com/shalomeir/snippod-boilerplate/blob/master/snippod_webapp/client/scripts/utils/RESTCall.js) and use it at Action like this.
PostsActions.getPosts.preEmit = function(requestUrl, query, callback) {
requestGet(requestUrl,query,callback)
.then(this.completed)
.catch(this.failed);
};
And Store have a 'onGetPostsCompleted' or 'onGetPostsFailed' method for handling response.
Peter Nguyen
@pengux
May 19 2015 07:36
I see, so all server requests go through a single Action instances? No need to share a singleton connection then?
shalomeir
@shalomeir
May 19 2015 07:37
yes.
Peter Nguyen
@pengux
May 19 2015 07:38
thanks
shalomeir
@shalomeir
May 19 2015 07:43
Welcome. Thanks too! @pengux
Jilles Soeters
@jillesme
May 19 2015 13:21
I love reflux :) How do I mix sync and async actions though? I have Reflux.createActions({ asyncMethod: { children: ['done', 'failed'] }, syncMethod: {} });
vogrelord
@vogrelord
May 19 2015 18:52
And what is not working?