forked from oOthkOo/hyper-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
33 lines (28 loc) · 759 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const { resolve: resolvePath } = require('path')
const MAIN = resolvePath(__dirname, './dist/main.js')
const Manager = require('./manager')
const manager = new Manager()
exports.onApp = (app) => {
manager.loadConfig()
}
exports.onWindow = (window) => {
window.rpc.on('manager-save', (options) => {
manager.setConfig(options)
manager.saveConfig()
})
}
exports.decorateMenu = (menu) => {
return manager.bindMenu(menu)
}
exports.decorateHyper = (Hyper, { React }) => {
return class extends React.Component {
constructor(props, context) {
super(props, context)
require(MAIN).default()
}
render() {
const newProps = Object.assign({}, this.props)
return React.createElement(Hyper, newProps)
}
}
}