diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-09-29 16:03:16 +0200 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-09-29 16:03:16 +0200 |
commit | 7f283791544195fa70c51003db9be3f029c014ef (patch) | |
tree | 4a5ac11ed2a3f1b6e6e0a8d3e7bedd641c0f186f /packages/gitbook-core/src/createStore.js | |
parent | 6f98ee18468e88af01a066eb6e203e4d6ef0a52c (diff) | |
download | gitbook-7f283791544195fa70c51003db9be3f029c014ef.zip gitbook-7f283791544195fa70c51003db9be3f029c014ef.tar.gz gitbook-7f283791544195fa70c51003db9be3f029c014ef.tar.bz2 |
Fix dist command
Diffstat (limited to 'packages/gitbook-core/src/createStore.js')
-rw-r--r-- | packages/gitbook-core/src/createStore.js | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/packages/gitbook-core/src/createStore.js b/packages/gitbook-core/src/createStore.js deleted file mode 100644 index 201a647..0000000 --- a/packages/gitbook-core/src/createStore.js +++ /dev/null @@ -1,36 +0,0 @@ -const Redux = require('redux'); -const ReduxThunk = require('redux-thunk').default; - -const coreReducers = require('./reducers'); -const composeReducer = require('./composeReducer'); - -/** - * Create a new redux store from an initial state and a list of plugins. - * Each plugin entry is the result of {createPlugin}. - * - * @param {Array<Plugin>} plugins - * @param {Object} initialState - * @return {ReduxStore} store - */ -function createStore(plugins, initialState) { - const pluginReducers = plugins.map(plugin => plugin.onReduceState); - const reducer = composeReducer(...[coreReducers].concat(pluginReducers)); - - const store = Redux.createStore( - (state, action) => { - console.log('[store]', action.type); - return reducer(state, action); - }, - initialState, - Redux.compose(Redux.applyMiddleware(ReduxThunk)) - ); - - // Initialize the plugins - plugins.forEach(plugin => { - plugin.onInitialState(store.dispatch, store.getState); - }); - - return store; -} - -module.exports = createStore; |