Electron hot reload

This commit is contained in:
Natsumi
2025-12-14 00:09:05 +11:00
parent 5c7b3a7cc7
commit 9d9805265a
2 changed files with 14 additions and 3 deletions
+1 -1
View File
@@ -16,7 +16,7 @@
"build-electron-arm64": "node ./src-electron/download-dotnet-runtime.js --arch=arm64 && node ./src-electron/patch-package-version.js && electron-builder --arm64 --publish never", "build-electron-arm64": "node ./src-electron/download-dotnet-runtime.js --arch=arm64 && node ./src-electron/patch-package-version.js && electron-builder --arm64 --publish never",
"postbuild-electron": "node ./src-electron/patch-node-api-dotnet.js --arch=x64 && node ./src-electron/rename-builds.js --arch=x64", "postbuild-electron": "node ./src-electron/patch-node-api-dotnet.js --arch=x64 && node ./src-electron/rename-builds.js --arch=x64",
"postbuild-electron-arm64": "node ./src-electron/patch-node-api-dotnet.js --arch=arm64 && node ./src-electron/rename-builds.js --arch=arm64", "postbuild-electron-arm64": "node ./src-electron/patch-node-api-dotnet.js --arch=arm64 && node ./src-electron/rename-builds.js --arch=arm64",
"start-electron": "electron ." "start-electron": "electron . --hot-reload"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
+13 -2
View File
@@ -56,6 +56,7 @@ const noInstall = args.includes('--no-install');
const x11 = args.includes('--x11'); const x11 = args.includes('--x11');
const noDesktop = args.includes('--no-desktop'); const noDesktop = args.includes('--no-desktop');
const startup = args.includes('--startup'); const startup = args.includes('--startup');
const debug = args.includes('--hot-reload');
const noUpdater = const noUpdater =
args.includes('--no-updater') || args.includes('--no-updater') ||
fs.existsSync(path.join(rootDir, '.no-updater')); fs.existsSync(path.join(rootDir, '.no-updater'));
@@ -327,6 +328,10 @@ function createWindow() {
applyWindowState(); applyWindowState();
const indexPath = path.join(rootDir, 'build/html/index.html'); const indexPath = path.join(rootDir, 'build/html/index.html');
mainWindow.loadFile(indexPath); mainWindow.loadFile(indexPath);
if (debug) {
mainWindow.loadURL('http://localhost:9000/index.html');
mainWindow.webContents.openDevTools();
}
// add proxy config, doesn't work, thanks electron // add proxy config, doesn't work, thanks electron
// const proxy = VRCXStorage.Get('VRCX_Proxy'); // const proxy = VRCXStorage.Get('VRCX_Proxy');
@@ -436,7 +441,10 @@ function createWristOverlayWindowOffscreen() {
}); });
wristOverlayWindow.webContents.setFrameRate(2); wristOverlayWindow.webContents.setFrameRate(2);
const indexPath = path.join(rootDir, 'build/html/vr.html'); let indexPath = path.join(rootDir, 'build/html/vr.html');
if (debug) {
indexPath = 'http://localhost:9000/vr.html';
}
const fileUrl = `file://${indexPath}?wrist`; const fileUrl = `file://${indexPath}?wrist`;
wristOverlayWindow.loadURL(fileUrl, { userAgent: version }); wristOverlayWindow.loadURL(fileUrl, { userAgent: version });
@@ -499,7 +507,10 @@ function createHmdOverlayWindowOffscreen() {
}); });
hmdOverlayWindow.webContents.setFrameRate(48); hmdOverlayWindow.webContents.setFrameRate(48);
const indexPath = path.join(rootDir, 'build/html/vr.html'); let indexPath = path.join(rootDir, 'build/html/vr.html');
if (debug) {
indexPath = 'http://localhost:9000/vr.html';
}
const fileUrl = `file://${indexPath}?hmd`; const fileUrl = `file://${indexPath}?hmd`;
hmdOverlayWindow.loadURL(fileUrl, { userAgent: version }); hmdOverlayWindow.loadURL(fileUrl, { userAgent: version });