React.createClass({ mixins: [ Reflux.connect(buildsStore, 'items') ], onCancelBuild: function(buildId) { BuildActions.cancel(buildId); }, render: template.locals(_({ Link: Router.Link }).extend(CommonComponents)) })
Reflux.createStore({ listenables: ChartActions, // propagate new maximum range value onSetRange: function(range) { this.trigger(range); } })
function getContacts() { return { contacts: ContactsStore.getContacts() } }
constructor(props) { super(props) this.state = { list: ItemsStore.getList() } }
componentDidMount() { this.unsubscribe = ItemsStore.listen(this.updateState.bind(this)) }
Reflux.createStore({ listenables: [Actions], getImage: function(id) { Api.get('gallery/' + id + '/comments') .then(function(json) { this.comment = json.data; this.triggerChange(); }.bind(this)); }, triggerChange: function() { this.trigger('change', this.comment); } })
React.createClass({ mixins: [Reflux.ListenerMixin, Router.Navigation], componentDidMount: function() { this.listenTo(buildsStore, this.navigateToBuild); BuildActions.readAll({limit: 1}); }, navigateToBuild: function(builds) { if (builds.length) { this.transitionTo('build', {id: builds[0].id}); } else { this.transitionTo('projectRunForm'); } }, // dummy render method, coz no view needed render: function() { return React.createElement('div'); } })
Reflux.createStore({ listenables: BuildActions, build: null, onChange: function(data) { if (this.build && (data.buildId === this.build.id)) { _(this.build).extend(data.changes); this.trigger(this.build); } }, init: function() { resource.subscribe('change', this.onChange); }, onRead: function(id) { var self = this; resource.sync('read', {id: id}, function(err, build) { if (err) throw err; self.build = build; self.trigger(self.build); }); } })
React.createClass({ mixins : [Reflux.connect(store, 'store')], componentDidMount: function() { actions.getTodos("all") }, render: function() { var store = this.state.store; return <div> <Title>Tasks</Title> <TodoFilter filter={store.filter} onChageFilter={actions.getTodos} /> <TodoList onToggleComplited={actions.toggleComplited} onRemove={actions.removeTodo} todos={store.todos} /> <AddTodoForm onAdd={actions.addTodo}/> </div> } })
Reflux.createStore({ listenables: ProjectActions, project: {}, getInitialState: function() { return this.project; }, onChange: function(data) { this.trigger(data.project); }, init: function() { resource.subscribe('change', this.onChange); }, onRead: function(params) { var self = this; resource.sync('read', params, function(err, project) { if (err) throw err; self.project = project; self.trigger(self.project); }); } })
Reflux.createStore({ listenables: ProjectActions, onRun: function(projectName, buildParams) { resource.sync('run', { projectName: projectName, buildParams: buildParams }, function(err) { if (err) throw err; }); }, onReadAll: function(params) { var self = this; resource.sync('readAll', params, function(err, projects) { if (err) throw err; self.trigger(projects); }); } })
Reflux.createStore({ listenables: [Actions], getImages: function(topicId) { return Api.get('topics/' + topicId) .then(function(json){ this.images = _.reject(json.data, function(image) { return image.is_album }); this.triggerChange(); }.bind(this)); }, triggerChange: function() { this.trigger('change', this.images); } })
Reflux.createStore({ listenables: [Actions], getTopics: function() { return Api.get('topics/defaults') .then(function(json){ this.topics = json.data; this.triggerChange(); }.bind(this)); }, triggerChange: function() { this.trigger('change', this.topics); } })
Reflux.createStore({ listenables: SelectorActions, onSelect: function(chartId) { this.trigger(chartId); } })
Reflux.createStore({ listenables: [ Actions ], getTopics: function() { Api.get('topics/defaults') .then(function(json) { this.topics = json.data; this.triggerChange(); }.bind(this)); }, triggerChange: function() { this.trigger('change', this.topics); } })