Files
gitbook/packages/gitbook-core/src/bootstrap.js
T
Samy Pesse f49089a7d3 Add immutable state for readme/summary
Add shapes for these states
2016-09-22 10:37:06 +02:00

31 lines
753 B
JavaScript

const ReactDOM = require('react-dom');
const getPayload = require('./lib/getPayload');
const createStore = require('./createStore');
const renderWithStore = require('./renderWithStore');
/**
* Bootstrap GitBook on the browser (this function should not be called on the server side)
*/
function bootstrap() {
const initialState = getPayload(window.document);
const plugins = window.gitbookPlugins;
console.log(initialState);
const mountNode = document.getElementById('content');
// Create the redux store
const store = createStore(plugins, initialState);
window.appStore = store;
// Render with the store
const el = renderWithStore(store);
ReactDOM.render(el, mountNode);
}
module.exports = bootstrap;