diff options
Diffstat (limited to 'packages/gitbook-core/src/lib')
-rw-r--r-- | packages/gitbook-core/src/lib/createContext.js | 16 | ||||
-rw-r--r-- | packages/gitbook-core/src/lib/createPlugin.js | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/packages/gitbook-core/src/lib/createContext.js b/packages/gitbook-core/src/lib/createContext.js index 1b834e4..d19e0f6 100644 --- a/packages/gitbook-core/src/lib/createContext.js +++ b/packages/gitbook-core/src/lib/createContext.js @@ -2,16 +2,16 @@ const Redux = require('redux'); const ReduxThunk = require('redux-thunk').default; -const Plugin = require('./models/Plugin'); -const Context = require('./models/Context'); +const Plugin = require('../models/Plugin'); +const Context = require('../models/Context'); const coreReducers = require('../reducers'); const composeReducer = require('./composeReducer'); -const Components = require('./actions/components'); -const I18n = require('./actions/i18n'); -const Navigation = require('./actions/navigation'); +const Components = require('../actions/components'); +const I18n = require('../actions/i18n'); +const Navigation = require('../actions/navigation'); -const corePlugin = Plugin({ +const corePlugin = new Plugin({ reduce: coreReducers, actions: { Components, I18n, Navigation @@ -31,7 +31,7 @@ function createContext(plugins, initialState) { // Compose the reducer from core with plugins const pluginReducers = plugins.map(plugin => plugin.reduce); - const reducer = composeReducer(pluginReducers); + const reducer = composeReducer(...pluginReducers); // Get actions from all plugins const actions = plugins.reduce((accu, plugin) => { @@ -52,7 +52,7 @@ function createContext(plugins, initialState) { plugin.init(store.dispatch, store.getState, actions); }); - return Context({ + return new Context({ store, actions }); diff --git a/packages/gitbook-core/src/lib/createPlugin.js b/packages/gitbook-core/src/lib/createPlugin.js index f03bb94..a2a3f42 100644 --- a/packages/gitbook-core/src/lib/createPlugin.js +++ b/packages/gitbook-core/src/lib/createPlugin.js @@ -9,7 +9,7 @@ const Plugin = require('../models/Plugin'); * @return {Plugin} */ function createPlugin({ init, reduce, actions }) { - const plugin = Plugin({ + const plugin = new Plugin({ init, reduce, actions |