mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-27 00:19:55 +03:00
stash
This commit is contained in:
parent
6e23e538ce
commit
0903e75b9c
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"import": true
|
||||
}
|
|
@ -85,7 +85,7 @@ function buildUrl(options) {
|
|||
|
||||
class DemoApp extends React.Component {
|
||||
render() {
|
||||
const options = getOptions();
|
||||
const options = getOptions(this.props.router.location);
|
||||
|
||||
return (
|
||||
<div style={styles.wrapper}>
|
||||
|
@ -193,7 +193,7 @@ class DemoApp extends React.Component {
|
|||
<div style={styles.links}>
|
||||
<a onClick={this.toggleExtension} style={styles.link}>
|
||||
{(options.useExtension ? 'Disable' : 'Enable') +
|
||||
' Chrome Extension'}
|
||||
' Chrome Extension (will reload this page)'}
|
||||
</a>
|
||||
<a onClick={this.toggleImmutableSupport} style={styles.link}>
|
||||
{(options.supportImmutable ? 'Disable' : 'Enable') +
|
||||
|
@ -205,15 +205,16 @@ class DemoApp extends React.Component {
|
|||
}
|
||||
|
||||
toggleExtension = () => {
|
||||
const options = getOptions();
|
||||
const options = getOptions(this.props.router.location);
|
||||
|
||||
this.props.pushRoute(
|
||||
buildUrl({ ...options, useExtension: !options.useExtension })
|
||||
);
|
||||
window.location.href = buildUrl({
|
||||
...options,
|
||||
useExtension: !options.useExtension,
|
||||
});
|
||||
};
|
||||
|
||||
toggleImmutableSupport = () => {
|
||||
const options = getOptions();
|
||||
const options = getOptions(this.props.router.location);
|
||||
|
||||
this.props.pushRoute(
|
||||
buildUrl({ ...options, supportImmutable: !options.supportImmutable })
|
||||
|
@ -221,7 +222,7 @@ class DemoApp extends React.Component {
|
|||
};
|
||||
|
||||
toggleTheme = () => {
|
||||
const options = getOptions();
|
||||
const options = getOptions(this.props.router.location);
|
||||
|
||||
this.props.pushRoute(buildUrl({ ...options, dark: !options.dark }));
|
||||
};
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
export default function getOptions() {
|
||||
export default function getOptions(location) {
|
||||
return {
|
||||
useExtension: window.location.search.indexOf('ext') !== -1,
|
||||
supportImmutable: window.location.search.indexOf('immutable') !== -1,
|
||||
useExtension: location.search.indexOf('ext') !== -1,
|
||||
supportImmutable: location.search.indexOf('immutable') !== -1,
|
||||
theme: do {
|
||||
const match = window.location.search.match(/theme=([^&]+)/);
|
||||
const match = location.search.match(/theme=([^&]+)/);
|
||||
match ? match[1] : 'inspector';
|
||||
},
|
||||
dark: window.location.search.indexOf('dark') !== -1,
|
||||
dark: location.search.indexOf('dark') !== -1,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -43,13 +43,10 @@ const getDevTools = ({ location }) =>
|
|||
changeMonitorKey="ctrl-m"
|
||||
>
|
||||
<DevtoolsInspector
|
||||
theme={do {
|
||||
const match = window.location.search.match(/theme=([^&]+)/);
|
||||
match ? match[1] : 'inspector';
|
||||
}}
|
||||
theme={getOptions(location).theme}
|
||||
shouldPersistState
|
||||
invertTheme={location.search.indexOf('dark') === -1}
|
||||
supportImmutable={location.search.indexOf('immutable') !== -1}
|
||||
invertTheme={getOptions(location).dark}
|
||||
supportImmutable={getOptions(location).supportImmutable}
|
||||
tabs={(defaultTabs) => [
|
||||
{
|
||||
name: 'Custom Tab',
|
||||
|
@ -64,13 +61,13 @@ const getDevTools = ({ location }) =>
|
|||
const ROOT =
|
||||
process.env.NODE_ENV === 'production' ? '/redux-devtools-inspector/' : '/';
|
||||
|
||||
const DevTools = getDevTools(getOptions());
|
||||
const DevTools = getDevTools({ location: window.location });
|
||||
|
||||
const history = createBrowserHistory();
|
||||
|
||||
const useDevtoolsExtension =
|
||||
!!window.__REDUX_DEVTOOLS_EXTENSION__ &&
|
||||
window.location.search.indexOf('ext') !== -1;
|
||||
getOptions(window.location).useExtension;
|
||||
|
||||
const enhancer = compose(
|
||||
applyMiddleware(logger, routerMiddleware(history)),
|
||||
|
|
Loading…
Reference in New Issue
Block a user