WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 8ed7f27

Browse files
committed
Make sure the electron-host-hook strays unobtrusive
1 parent 321b8cd commit 8ed7f27

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/ElectronNET.Host/main.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ const path = require('path');
55
const cProcess = require('child_process').spawn;
66
const portscanner = require('portscanner');
77
const { imageSize } = require('image-size');
8-
const { HookService } = require('electron-host-hook');
98
let io, server, browserWindows, ipc, apiProcess, loadURL;
109
let appApi, menu, dialogApi, notification, tray, webContents;
1110
let globalShortcut, shellApi, screen, clipboard, autoUpdater;
1211
let commandLine, browserView;
1312
let powerMonitor;
1413
let processInfo;
15-
let splashScreen, hostHook;
14+
let splashScreen;
1615
let nativeTheme;
1716
let dock;
1817
let launchFile;
@@ -263,6 +262,7 @@ function startSocketApiBridge(port) {
263262
console.log('Electron Socket: starting...');
264263
server = require('http').createServer();
265264
const { Server } = require('socket.io');
265+
let hostHook;
266266
io = new Server({
267267
pingTimeout: 60000, // in ms, default is 5000
268268
pingInterval: 10000, // in ms, default is 25000
@@ -359,21 +359,24 @@ function startSocketApiBridge(port) {
359359
});
360360

361361
try {
362+
const { HookService } = require('electron-host-hook');
363+
362364
if (hostHook === undefined) {
363365
hostHook = new HookService(socket, app);
364366
hostHook.onHostReady();
365367
}
366368
} catch (error) {
367369
console.error(error.message);
368370
}
371+
369372
console.log('Electron Socket: startup complete.');
370373
});
371374
}
372375

373376
function startAspCoreBackend(electronPort) {
374377
startBackend();
375378

376-
function startBackend() {
379+
function startBackend() {
377380
loadURL = `about:blank`;
378381
const envParam = getEnvironmentParameter();
379382
const parameters = [

0 commit comments

Comments
 (0)