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 | |
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')
-rw-r--r-- | packages/gitbook-core/package.json | 3 | ||||
-rw-r--r-- | packages/gitbook-core/src/createPlugin.js | 2 | ||||
-rw-r--r-- | packages/gitbook-core/src/createStore.js | 6 |
3 files changed, 7 insertions, 4 deletions
diff --git a/packages/gitbook-core/package.json b/packages/gitbook-core/package.json index c75f05d..387a610 100644 --- a/packages/gitbook-core/package.json +++ b/packages/gitbook-core/package.json @@ -24,7 +24,8 @@ "scripts": { "dist-lib": "rm -rf lib/ && babel -d lib/ src/", "dist-standalone": "browserify -r ./lib/index.js:gitbook-core -r react -r react-dom ./lib/index.js | uglifyjs -c > gitbook.core.min.js", - "prepublish": "npm run dist-lib && npm run dist-standalone" + "dist": "npm run dist-lib && npm run dist-standalone", + "prepublish": "npm run dist" }, "repository": { "type": "git", 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 |