mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28:41 -09:00
config: add plugins hook and decoration
This commit is contained in:
parent
c97b67b4c8
commit
eb147d9b9a
1 changed files with 4 additions and 1 deletions
|
|
@ -20,17 +20,20 @@ export default class Config extends React.Component {
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
ipcRenderer.on('config change', this.onChange);
|
ipcRenderer.on('config change', this.onChange);
|
||||||
|
ipcRenderer.on('plugins change', this.onChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
// passes `config` as props to the decorated component
|
// passes `config` as props to the decorated component
|
||||||
render () {
|
render () {
|
||||||
const child = React.Children.only(this.props.children);
|
const child = React.Children.only(this.props.children);
|
||||||
const { config } = this.state;
|
const { config } = this.state;
|
||||||
return React.cloneElement(child, { config });
|
const decorate = remote.require('./plugins').decorateConfig;
|
||||||
|
return React.cloneElement(child, { config: decorate(config) });
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount () {
|
componentWillUnmount () {
|
||||||
ipcRenderer.removeListener('config change', this.onChange);
|
ipcRenderer.removeListener('config change', this.onChange);
|
||||||
|
ipcRenderer.removeListener('plugins change', this.onChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue