summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-core/src/lib/createPlugin.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gitbook-core/src/lib/createPlugin.js')
-rw-r--r--packages/gitbook-core/src/lib/createPlugin.js17
1 files changed, 6 insertions, 11 deletions
diff --git a/packages/gitbook-core/src/lib/createPlugin.js b/packages/gitbook-core/src/lib/createPlugin.js
index 7a49053..f03bb94 100644
--- a/packages/gitbook-core/src/lib/createPlugin.js
+++ b/packages/gitbook-core/src/lib/createPlugin.js
@@ -1,24 +1,19 @@
-
-const defaultInit = ((dispatch, getState) => {});
-const defaultReduce = ((state, action) => state);
+const Plugin = require('../models/Plugin');
/**
* Create a plugin to extend the state and the views.
*
- * @param {Function(dispatch, state)} onInitialState
- * @param {Funciton(state, action)} onReduceState
+ * @param {Function(dispatch, state)} plugin.init
+ * @param {Function(state, action)} plugin.reduce
+ * @param {Object} plugin.actions
* @return {Plugin}
*/
function createPlugin({ init, reduce, actions }) {
- init = init || defaultInit;
- reduce = reduce || defaultReduce;
- actions = actions || {};
-
- const plugin = {
+ const plugin = Plugin({
init,
reduce,
actions
- };
+ });
if (typeof window !== 'undefined') {
window.gitbookPlugins = window.gitbookPlugins || [];