File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 11var React = require ( 'react' ) ;
2+ var Reflux = require ( 'reflux' ) ;
3+ var ImageStore = require ( '../stores/image-store' ) ;
24
35module . exports = React . createClass ( {
6+ mixins : [
7+ Reflux . listenTo ( ImageStore , 'onChange' )
8+ ] ,
49 render : function ( ) {
510 return < div >
611 I am an image detail.
712 </ div >
13+ } ,
14+ onChange : function ( event , image ) {
15+ this . setState ( {
16+ image : image
17+ } ) ;
818 }
919} ) ;
Original file line number Diff line number Diff line change @@ -15,6 +15,16 @@ module.exports = Reflux.createStore({
1515 this . triggerChange ( ) ;
1616 } . bind ( this ) ) ;
1717 } ,
18+ find : function ( id ) {
19+ var image = _ . findWhere ( this . images , { id : id } ) ;
20+
21+ if ( image ) {
22+ return image
23+ } else {
24+ this . getImage ( id ) ;
25+ return null
26+ }
27+ } ,
1828 triggerChange : function ( ) {
1929 this . trigger ( 'change' , this . images ) ;
2030 }
You can’t perform that action at this time.
0 commit comments