diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-10-03 14:56:55 +0200 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-10-03 14:56:55 +0200 |
commit | d82032298dcbfc5c1a6d011a5afe72af9e21ab42 (patch) | |
tree | 8c8197be2527f1f3c0f72bc1a4ef711e26241622 /packages/gitbook-core/src/lib | |
parent | 34eb35699d951783837faf026a60abadc888a010 (diff) | |
download | gitbook-d82032298dcbfc5c1a6d011a5afe72af9e21ab42.zip gitbook-d82032298dcbfc5c1a6d011a5afe72af9e21ab42.tar.gz gitbook-d82032298dcbfc5c1a6d011a5afe72af9e21ab42.tar.bz2 |
Fix new api for activate/deactivate
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 }); |