Last active
August 25, 2016 15:14
-
-
Save zalmoxisus/de456d1192f31bf381c0 to your computer and use it in GitHub Desktop.
Open Redux DevTools in a new window
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createStore, applyMiddleware, compose } from 'redux'; | |
// import { persistState } from 'redux-devtools'; | |
import rootReducer from '../reducers'; | |
import DevTools from '../containers/DevTools'; | |
export default function configureStore(initialState) { | |
const finalCreateStore = compose( | |
DevTools.instrument(), | |
// persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/)) | |
)(createStore); | |
const store = finalCreateStore(rootReducer); | |
if (module.hot) { | |
module.hot.accept('../reducers', () => | |
store.replaceReducer(require('../reducers').default) | |
); | |
} | |
window.showDevTools = () => { | |
require('../utils/debug/createDevToolsWindow')(store); | |
}; | |
return store; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on https://gist.github.com/tlrobinson/1e63d15d3e5f33410ef7 | |
import React from 'react'; | |
import { render } from 'react-dom'; | |
import DevTools from '../../containers/DevTools'; | |
export default function createDevToolsWindow(store) { | |
const win = window.open(null, 'redux-devtools', | |
'menubar=no,location=no,resizable=yes,scrollbars=yes,status=no,width=300,height=300'); | |
win.location.reload(); | |
setTimeout(() => { | |
render(<DevTools store={store} />), win.document.body); | |
}, 10); | |
window.onunload = function() { | |
win.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment