chore: Update load function in adapter-electron to include optional path parameter

This commit is contained in:
Karechta
2024-06-16 05:42:39 +02:00
parent d0539519c4
commit 4f3fcf4157
2 changed files with 6 additions and 6 deletions

View File

@@ -1,2 +1,2 @@
export function load(mainWindow: any, port: string | undefined): void;
export function load(mainWindow: any, port: string | undefined, path: string | undefined): void;
export function start(): Promise<string | undefined>;

View File

@@ -31,12 +31,12 @@ export const start = async () => {
};
/** @type {import('./index.js').load} */
export const load = (mainWindow, port) => {
export const load = (mainWindow, port, path = '') => {
if (isDev && process.env['ELECTRON_RENDERER_URL']) {
log.info(`Loading url: ${process.env['ELECTRON_RENDERER_URL']}`);
mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL']);
log.info(`Loading url: ${process.env['ELECTRON_RENDERER_URL']}${path}`);
mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL']+path);
} else {
log.info(`Loading url: http://localhost:${port}`);
mainWindow.loadURL(`http://localhost:${port}`);
log.info(`Loading url: http://localhost:${port}${path}`);
mainWindow.loadURL(`http://localhost:${port}${path}`);
}
};