diff options
Diffstat (limited to 'packages/gitbook-core/src/lib')
-rw-r--r-- | packages/gitbook-core/src/lib/createContext.js | 14 | ||||
-rw-r--r-- | packages/gitbook-core/src/lib/createPlugin.js | 5 |
2 files changed, 11 insertions, 8 deletions
diff --git a/packages/gitbook-core/src/lib/createContext.js b/packages/gitbook-core/src/lib/createContext.js index 2a826d1..c88baad 100644 --- a/packages/gitbook-core/src/lib/createContext.js +++ b/packages/gitbook-core/src/lib/createContext.js @@ -66,15 +66,17 @@ function createContext(plugins, initialState) { Redux.compose(Redux.applyMiddleware(thunk)) ); - // Initialize the plugins - plugins.forEach(plugin => { - plugin.init(store.dispatch, store.getState, actions); - }); - - return new Context({ + // Create the context + const context = new Context({ store, + plugins, actions }); + + // Initialize the plugins + context.activate(); + + return context; } module.exports = createContext; diff --git a/packages/gitbook-core/src/lib/createPlugin.js b/packages/gitbook-core/src/lib/createPlugin.js index a2a3f42..cb5d2be 100644 --- a/packages/gitbook-core/src/lib/createPlugin.js +++ b/packages/gitbook-core/src/lib/createPlugin.js @@ -8,9 +8,10 @@ const Plugin = require('../models/Plugin'); * @param {Object} plugin.actions * @return {Plugin} */ -function createPlugin({ init, reduce, actions }) { +function createPlugin({ activate, deactivate, reduce, actions }) { const plugin = new Plugin({ - init, + activate, + deactivate, reduce, actions }); |