diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-09-20 19:19:01 +0200 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-09-20 19:19:01 +0200 |
commit | ced0be930dd86bc204cab5b4e3a1cd83aed68ccf (patch) | |
tree | ede7dcb971554be669e9b4e9db42899c52fed20f /packages/gitbook-core/src | |
parent | 6d58a90613802b1e65cbf8c027093a1868119781 (diff) | |
download | gitbook-ced0be930dd86bc204cab5b4e3a1cd83aed68ccf.zip gitbook-ced0be930dd86bc204cab5b4e3a1cd83aed68ccf.tar.gz gitbook-ced0be930dd86bc204cab5b4e3a1cd83aed68ccf.tar.bz2 |
Working loading of plugin
Diffstat (limited to 'packages/gitbook-core/src')
-rw-r--r-- | packages/gitbook-core/src/createPlugin.js | 2 | ||||
-rw-r--r-- | packages/gitbook-core/src/createStore.js | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/packages/gitbook-core/src/createPlugin.js b/packages/gitbook-core/src/createPlugin.js index c26d745..d00c99d 100644 --- a/packages/gitbook-core/src/createPlugin.js +++ b/packages/gitbook-core/src/createPlugin.js @@ -7,6 +7,8 @@ * @return {Plugin} */ function createPlugin(onInitialState, onReduceState) { + onReduceState = onReduceState || ((state, action) => state); + const plugin = { onInitialState, onReduceState diff --git a/packages/gitbook-core/src/createStore.js b/packages/gitbook-core/src/createStore.js index c13f219..4873190 100644 --- a/packages/gitbook-core/src/createStore.js +++ b/packages/gitbook-core/src/createStore.js @@ -13,12 +13,12 @@ const reducers = require('./reducers'); */ function createStore(plugins, initialState) { const pluginReducers = plugins.map(plugin => plugin.onReduceState); + console.log(pluginReducers); const reducer = Redux.compose(reducers, ...pluginReducers); - const store = Redux.createStore( - reducer, + reducers, initialState, - Redux.applyMiddleware(ReduxThunk) + Redux.compose(Redux.applyMiddleware(ReduxThunk)) ); // Initialize the plugins |