mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-12 17:26:17 +00:00
30 lines
747 B
JavaScript
30 lines
747 B
JavaScript
import ConfigManager from './ConfigManager'
|
|
|
|
const nodeIpc = require('node-ipc')
|
|
const { remote, ipcRenderer } = require('electron')
|
|
const { app } = remote
|
|
const path = require('path')
|
|
|
|
nodeIpc.config.id = 'main'
|
|
nodeIpc.config.retry = 1500
|
|
nodeIpc.config.silent = true
|
|
|
|
nodeIpc.connectTo(
|
|
'node',
|
|
path.join(app.getPath('userData'), 'boostnote.service'),
|
|
function () {
|
|
nodeIpc.of.node.on('error', function (err) {
|
|
console.log(err)
|
|
})
|
|
nodeIpc.of.node.on('connect', function () {
|
|
console.log('Connected successfully')
|
|
ipcRenderer.send('config-renew', {config: ConfigManager.get()})
|
|
})
|
|
nodeIpc.of.node.on('disconnect', function () {
|
|
console.log('disconnected')
|
|
})
|
|
}
|
|
)
|
|
|
|
module.exports = nodeIpc
|