mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18: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 () {
|
||||
ipcRenderer.on('config change', this.onChange);
|
||||
ipcRenderer.on('plugins change', this.onChange);
|
||||
}
|
||||
|
||||
// passes `config` as props to the decorated component
|
||||
render () {
|
||||
const child = React.Children.only(this.props.children);
|
||||
const { config } = this.state;
|
||||
return React.cloneElement(child, { config });
|
||||
const decorate = remote.require('./plugins').decorateConfig;
|
||||
return React.cloneElement(child, { config: decorate(config) });
|
||||
}
|
||||
|
||||
componentWillUnmount () {
|
||||
ipcRenderer.removeListener('config change', this.onChange);
|
||||
ipcRenderer.removeListener('plugins change', this.onChange);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue