Skip to content

Commit

Permalink
fix: replace skeleton-ready with function
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Mar 14, 2021
1 parent fe61980 commit ccc7719
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 19 deletions.
13 changes: 4 additions & 9 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ system.on('skeleton-start-minimised', function (minimised) {
system.emit('config_set', 'start_minimised', minimised)
})

system.once('skeleton-ready', function () {
if (system.headless === true) {
system.ready = function (logToFile) {
if (logToFile) {
debug('Going into headless mode. Logs will be written to companion.log')

setInterval(function () {
Expand Down Expand Up @@ -187,11 +187,6 @@ system.once('skeleton-ready', function () {
system.on('exit', function () {
elgatoDM.quit()
})
})

exports = module.exports = function (headless) {
if (headless !== undefined && headless === true) {
system.headless = true
}
return system
}

exports = module.exports = system
7 changes: 3 additions & 4 deletions electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ var app = electron.app
var BrowserWindow = electron.BrowserWindow
var path = require('path')
var url = require('url')
var main = require('./app.js')
var system = main()
var system = require('./app.js')
var fs = require('fs')
var exec = require('child_process').exec
const { init, showReportDialog, configureScope } = require('@sentry/electron')
Expand Down Expand Up @@ -111,8 +110,8 @@ function createWindow() {
system.emit('skeleton-start-minimised', msg)
})

ipcMain.on('skeleton-ready', function () {
system.emit('skeleton-ready')
ipcMain.once('skeleton-ready', function () {
system.ready(!process.env.DEVELOPER)
})

ipcMain.on('network-interfaces:get', function () {
Expand Down
5 changes: 2 additions & 3 deletions headless.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env node
var main = require('./app.js')
var system = main(process.env.DEVELOPER ? false : true)
var system = require('./app.js')
var os = require('os')

console.log('Starting')
Expand Down Expand Up @@ -65,7 +64,7 @@ if (process.argv[2] in ifaces) {
setTimeout(function () {
system.emit('skeleton-bind-ip', address)
system.emit('skeleton-bind-port', port)
system.emit('skeleton-ready')
system.ready(!process.env.DEVELOPER)
console.log('Started')
}, 1000)
} else {
Expand Down
5 changes: 2 additions & 3 deletions headless_ip.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env node
var main = require('./app.js')
var system = main(true)
var system = require('./app.js')

console.log('Starting')

Expand All @@ -25,6 +24,6 @@ if (process.argv[3] != null) {
setTimeout(function () {
system.emit('skeleton-bind-ip', process.argv[2])
system.emit('skeleton-bind-port', port)
system.emit('skeleton-ready')
system.ready(!process.env.DEVELOPER)
console.log('Started')
}, 1000)

0 comments on commit ccc7719

Please sign in to comment.