prva verzija

This commit is contained in:
Hamza Iseric
2018-12-07 01:39:20 +01:00
parent b5ec65d8dd
commit 5dc6c76750
18 changed files with 21453 additions and 0 deletions

24
src/electron-react.js Normal file
View File

@@ -0,0 +1,24 @@
const net = require('net')
const port = process.env.PORT ? process.env.PORT - 100 : 3002
process.env.ELECTRON_START_URL = `http://localhost:${port}`
const client = new net.Socket()
let startedElectron = false
const tryConnection = () =>
client.connect({ port: port }, () => {
client.end()
if (!startedElectron) {
console.log('starting electron')
startedElectron = true
const exec = require('child_process').exec
exec('npm run electron')
}
})
tryConnection()
client.on('error', error => {
setTimeout(tryConnection, 1000)
})