Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Lendar/2c9aca52b6cb913a996d to your computer and use it in GitHub Desktop.
Save Lendar/2c9aca52b6cb913a996d to your computer and use it in GitHub Desktop.
Put the awesome redux-devtools in it's own window so it doesn't obscure or be obscured by your application
import React from 'react'
import { DevTools, DebugPanel, LogMonitor } from 'redux-devtools/lib/react'
export default function openDebugPanel (store) {
const width = 0.3 * screen.width
const left = 0.7 * screen.width - 5
const height = screen.height
const win = window.open(
null,
'redux-devtools',
`left=${left},width=${width},height=${height},
menubar=no,location=no,resizable=yes,scrollbars=no,status=no`)
win.location.reload()
setTimeout(() => {
React.render(
<DebugPanel top right bottom left >
<DevTools store={store} monitor={LogMonitor} />
</DebugPanel>
, win.document.body)
}, 10)
}
window.React = window.React || {}
window.React.Perf = window.React.Perf || require('react/lib/ReactDefaultPerf')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment