File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed
src/ChatReact/ChatReact/js/components Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -19,12 +19,10 @@ var MessagesStore = Reflux.createStore({
19
19
this . messages = [ ] ;
20
20
} ,
21
21
didConnect : function ( ) {
22
- this . messages . push ( { msg : "CONNECTED!" , cls : "open" } ) ;
23
- this . trigger ( this . messages ) ;
22
+ this . addMessages ( [ { message : "CONNECTED!" , cls : "open" } ] ) ;
24
23
} ,
25
24
logError : function ( ) {
26
- this . messages . push ( { msg : "ERROR!" , cls : "error" } ) ;
27
- this . trigger ( this . messages ) ;
25
+ this . addMessages ( [ { message : "ERROR!" , cls : "error" } ] ) ;
28
26
} ,
29
27
addMessages : function ( msgs ) {
30
28
var $this = this ;
Original file line number Diff line number Diff line change 1
1
var ChatApp = React . createClass ( {
2
2
mixins :[
3
3
Reflux . listenTo ( MessagesStore , "onMessagesUpdate" ) ,
4
- Reflux . listenTo ( UsersStore , "onUsersUpdate" )
4
+ Reflux . listenTo ( UsersStore , "onUsersUpdate" ) ,
5
+ Reflux . listenTo ( Actions . announce , "announce" ) ,
6
+ Reflux . listenTo ( Actions . showError , "showError" )
5
7
] ,
6
8
templates : {
7
9
youtube : function ( id ) {
@@ -29,8 +31,6 @@ var ChatApp = React.createClass({
29
31
componentDidMount : function ( ) {
30
32
var $this = this ;
31
33
32
- this . listenToMany ( Actions ) ;
33
-
34
34
this . source = new EventSource ( '/event-stream?channel=' + this . props . channel + '&t=' + new Date ( ) . getTime ( ) ) ; //disable cache
35
35
this . source . onerror = function ( e ) {
36
36
Actions . logError ( e ) ;
Original file line number Diff line number Diff line change 1
1
var Footer = React . createClass ( {
2
- mixins :[ Reflux . listenToMany ( Actions ) ] ,
2
+ mixins :[
3
+ Reflux . listenTo ( Actions . userSelected , "userSelected" ) ,
4
+ Reflux . listenTo ( Actions . setText , "setText" )
5
+ ] ,
3
6
getInitialState : function ( ) {
4
7
return {
5
8
value :'' ,
You can’t perform that action at this time.
0 commit comments