| 139 | } |
| 140 | |
| 141 | function onAppWebContentsCreated(event: Electron.Event, webContents: Electron.WebContents): void { |
| 142 | // Open links to web pages in the OS-es default browser |
| 143 | // (instead of navigating to it with the electron window that opened it) |
| 144 | webContents.on('will-navigate', onNewPage); |
| 145 | webContents.on('new-window', onNewPage); |
| 146 | |
| 147 | function onNewPage(event: Electron.Event, navigationUrl: string): void { |
| 148 | event.preventDefault(); |
| 149 | shell.openExternal(navigationUrl); |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | function onAppActivate(): void { |
| 154 | // On OS X it's common to re-create a window in the app when the |