redux-plugins-immutable

所属分类:前端开发
开发工具:JavaScript
文件大小:0KB
下载次数:0
上传日期:2017-03-22 21:18:19
上 传 者sh-1993
说明:  使用不可变状态的强大的面向特征的redux编程代码拆分系统,
(a powerful feature-oriented programming code-splitting system for redux using immutable state,)

文件列表:
.babelrc (145, 2017-03-22)
.eslintrc (512, 2017-03-22)
.flowconfig (407, 2017-03-22)
.npmignore (61, 2017-03-22)
package.json (1621, 2017-03-22)
spec/ (0, 2017-03-22)
spec/support/ (0, 2017-03-22)
spec/support/jasmine.json (172, 2017-03-22)
src/ (0, 2017-03-22)
src/.eslintrc (58, 2017-03-22)
src/index.js (258, 2017-03-22)
src/pluginActions.js (1085, 2017-03-22)
src/pluginMiddleware.js (2358, 2017-03-22)
src/pluginReducer.js (3468, 2017-03-22)
src/pluginTypes.js (179, 2017-03-22)
src/reduxTypes.js (355, 2017-03-22)
test/ (0, 2017-03-22)
test/.eslintrc (57, 2017-03-22)
test/pluginMiddlewareTests.js (6461, 2017-03-22)
test/pluginReducerTests.js (6823, 2017-03-22)

# redux-plugins-immutable A feature-oriented programming and code-splitting framework for [Redux](https://github.com/jcoreio/redux-plugins-immutable/blob/master/redux.js.org). Asynchronously load Redux reducers and middleware, React Components, [react-router](https://github.com/jcoreio/redux-plugins-immutable/blob/master/https://github.com/reactjs/react-router) routes, etc. in app plugins, using Webpack code splitting. ## Requirements * ES6 polyfills (corejs) * Your Redux state must be an Immutable.js keyed collection. If you want to use this library with POJOs, you'll have to port it to do so. ## Ecosystem * [redux-plugins-immutable-react](https://github.com/jcoreio/redux-plugins-immutable/blob/master/http://github.com/jcoreio/redux-plugins-immutable-react): React components to autoload plugins and display components from them * [redux-plugins-immutable-react-router](https://github.com/jcoreio/redux-plugins-immutable/blob/master/http://github.com/jcoreio/redux-plugins-immutable-react-router): autoload [react-router](https://github.com/jcoreio/redux-plugins-immutable/blob/master/https://github.com/reactjs/react-router) route configuration from plugins * [redux-plugins-immutable-hot-loader](https://github.com/jcoreio/redux-plugins-immutable/blob/master/http://github.com/jcoreio/redux-plugins-immutable-hot-loader): Webpack hot reloader for plugins ## Usage Example ```js import Immutable from 'immutable'; import {createStore, applyMiddleware} from 'redux'; import {composeReducers} from 'mindfront-redux-utils'; import {pluginMiddleware, pluginReducer, pluginActions} from 'redux-plugins-immutable'; const {addPlugin, loadPlugin} = pluginActions; import MyReducer from './MyReducer'; const store = applyMiddleware(pluginMiddleware)(createStore)( composeReducers(MyReducer, pluginReducer), Immutable.Map() ); const PLUGIN_KEY = 'MyPlugin'; const Plugin = Immutable.fromJS({ key: PLUGIN_KEY, // this method will be called when a loadPlugin action is dispatched with this plugin's key. // it is passed the Redux store and a node-style callback. // the result it passes to the callback will get shallow merged into this plugin in Redux state. load(store, callback) { require.ensure(['./MyPluginReducer', './MyPluginMiddleware', './MyPluginComponent'], require => { callback(undefined, Immutable.fromJS({ reducer: require('./MyPluginReducer').default, middleware: require('./MyPluginMiddleware').default, components: { MyPluginComponent: require('./MyPluginComponent').default } })); }); } }); // this puts Plugin in the Redux state at ['plugins', PLUGIN_KEY] store.dispatch(addPlugin(Plugin)); // ... // Sometime later, when you need to load the plugin: // this will call Plugin's load() method. store.dispatch(loadPlugin(PLUGIN_KEY)).then(plugin => { // at this point the plugin is loaded (all the fields passed to the load() callback // have been merged into the Redux state for the plugin). // pluginReducer will apply Plugin's reducer, and pluginMiddleware will apply Plugin's middleware. // Plugin's MyPluginComponent will be available to use as well. }); ```

近期下载者

相关文件


收藏者