Skip to content

Commit

Permalink
Log when openExternal is called in window event handlers (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeichestakov authored Mar 21, 2024
1 parent 28941bc commit 008d62f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/createWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export function createWindow(props?: WindowProps): BrowserWindow {
};
}

log.info('Opening external URL in window open handler: ', details);
shell.openExternal(details.url);

return {
Expand All @@ -202,8 +203,8 @@ export function createWindow(props?: WindowProps): BrowserWindow {
setLastOpenRepl(navigationUrl, lastOpenRepl);
});

window.webContents.on('will-navigate', (event, navigationUrl) => {
const u = new URL(navigationUrl);
window.webContents.on('will-navigate', (event) => {
const u = new URL(event.url);

const isReplit = u.origin === baseUrl;

Expand All @@ -216,7 +217,8 @@ export function createWindow(props?: WindowProps): BrowserWindow {
}

event.preventDefault();
shell.openExternal(navigationUrl);
log.info('Opening external URL in will-navigate event handler: ', event);
shell.openExternal(event.url);
}
});

Expand Down

0 comments on commit 008d62f

Please sign in to comment.