electron/docs/fiddles/windows/manage-windows/new-window/renderer.js
2023-08-10 11:55:52 +02:00

14 lines
480 B
JavaScript

const { shell, ipcRenderer } = require('electron')
const newWindowBtn = document.getElementById('new-window')
const link = document.getElementById('browser-window-link')
newWindowBtn.addEventListener('click', (event) => {
const url = 'https://electronjs.org'
ipcRenderer.send('new-window', { url, width: 400, height: 320 })
})
link.addEventListener('click', (e) => {
e.preventDefault()
shell.openExternal('https://www.electronjs.org/docs/latest/api/browser-window')
})