This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import {Decorator as Cerebral} from 'cerebral-react'; | |
| import {CSSTransitionGroup} from 'react-addons'; | |
| import Home from './Home.js'; | |
| import Admin from './Admin.js'; | |
| @Cerebral({ | |
| title: ['title'], | |
| currentPage: ['currentPage'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Store from 'immutable-store'; | |
| // Any mutations to an immutable-store returns the new mutated store as a result of the operation. | |
| // More info at: https://github.com/christianalfoni/immutable-store | |
| export default function (state = Store({todos: []}), action) { | |
| switch (action.type) { | |
| case ADD_TODO: | |
| return state.todos.push(action.payload); | |
| case REMOVE_TODO: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import {Decorator as State} from 'cerebral-react-immutable-store'; | |
| import {views} from './constants.js'; | |
| import Home from './Home.js'; | |
| import Messages from './Messages.js'; | |
| @State({view: ['view']}) | |
| class App extends React.Component { | |
| render() { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| IT WAS SO NICE TO USE THE MODULE ARG | |
| */ | |
| // With context | |
| function action ({module}) { | |
| module.state.set('foo', 'bar'); | |
| } | |
| // Now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var React = require('react') | |
| var callbacks = [] | |
| var listener = false | |
| module.exports = { | |
| contextTypes: { | |
| controller: React.PropTypes.object | |
| }, | |
| componentWillMount: function () { | |
| this.signals = this.context.controller.isServer ? {} : this.context.controller.getSignals() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var React = require('react') | |
| var mixin = require('./mixin.js') | |
| module.exports = function (Component, paths) { | |
| return React.createClass({ | |
| displayName: Component.name + 'Container', | |
| mixins: [mixin], | |
| componentWillReceiveProps: function (nextProps) { | |
| this._update(null, nextProps); | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var React = require('react') | |
| var callbacks = [] | |
| var listener = false | |
| var currentUpdateLoopId = 0 | |
| module.exports = { | |
| contextTypes: { | |
| controller: React.PropTypes.object | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var React = require('react') | |
| var callbacks = [] | |
| var listener = false | |
| var currentUpdateLoopId = 0 | |
| module.exports = { | |
| contextTypes: { | |
| controller: React.PropTypes.object | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function ModulesProvider(context, execution, controller) { | |
| var modules = controller.getModules(); | |
| var services = controller.getServices(); | |
| context.modules = Object.keys(modules).reduce(function (contextModules, key) { | |
| var modulePath = key.split('.'); | |
| var module = modulePath.reduce(function (contextModules, pathKey) { | |
| contextModules[pathKey] = contextModules[pathKey] || {}; | |
| return contextModules[pathKey]; | |
| }, contextModules); | |
| module.meta = modules[key]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {signal, dispatch} from 'redux-action-tree'; | |
| import {SET_LOADING, SET_DATA, UNSET_LOADING, SET_ERROR} from 'constants'; | |
| import getData from 'actions/getData'; | |
| // Use a signal factory to create a signal | |
| export default signal([ | |
| // The dispatch factory allows you to easily dispatch actions. The current payload is always passed. | |
| // Giving {type: "SET_LOADING", payload: {}} as action | |
| dispatch(SET_LOADING), | |
OlderNewer