mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-22 09:36:43 +03:00
Merge pull request #75 from jackielii/visible-on-load
add visibleOnLoad props to LogMonitor
This commit is contained in:
commit
d3b850f750
|
@ -15,6 +15,7 @@ A live-editing time travel environment for [Redux](https://github.com/rackt/redu
|
||||||
* With `persistState()` store enhancer, you can persist debug sessions across page reloads
|
* With `persistState()` store enhancer, you can persist debug sessions across page reloads
|
||||||
* To monitor a part of the state, you can set a `select` prop on the DevTools component: `<DevTools select={state => state.todos} store={store} monitor={LogMonitor} />`
|
* To monitor a part of the state, you can set a `select` prop on the DevTools component: `<DevTools select={state => state.todos} store={store} monitor={LogMonitor} />`
|
||||||
* Toggle visibility with Ctrl+H
|
* Toggle visibility with Ctrl+H
|
||||||
|
* To hide the devtools on load, set `visibleOnLoad` to false, e.g.: `<DevTools store={store} monitor={LogMonitor} visibleOnLoad={false} />`
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ export default class App extends Component {
|
||||||
</Provider>
|
</Provider>
|
||||||
<DebugPanel top right bottom>
|
<DebugPanel top right bottom>
|
||||||
<DevTools store={store}
|
<DevTools store={store}
|
||||||
monitor={LogMonitor} />
|
monitor={LogMonitor} visibleOnLoad={true} />
|
||||||
</DebugPanel>
|
</DebugPanel>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -52,13 +52,15 @@ export default class LogMonitor {
|
||||||
toggleAction: PropTypes.func.isRequired,
|
toggleAction: PropTypes.func.isRequired,
|
||||||
jumpToState: PropTypes.func.isRequired,
|
jumpToState: PropTypes.func.isRequired,
|
||||||
setMonitorState: PropTypes.func.isRequired,
|
setMonitorState: PropTypes.func.isRequired,
|
||||||
select: PropTypes.func.isRequired
|
select: PropTypes.func.isRequired,
|
||||||
|
visibleOnLoad: PropTypes.bool
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
select: (state) => state,
|
select: (state) => state,
|
||||||
monitorState: { isVisible: true },
|
monitorState: { isVisible: true },
|
||||||
theme: 'nicinabox'
|
theme: 'nicinabox',
|
||||||
|
visibleOnLoad: true
|
||||||
};
|
};
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
|
@ -90,6 +92,15 @@ export default class LogMonitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillMount() {
|
||||||
|
let visibleOnLoad = this.props.visibleOnLoad;
|
||||||
|
const { monitorState } = this.props;
|
||||||
|
this.props.setMonitorState({
|
||||||
|
...monitorState,
|
||||||
|
isVisible: visibleOnLoad
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
handleRollback() {
|
handleRollback() {
|
||||||
this.props.rollback();
|
this.props.rollback();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user