electron/docs/fiddles/windows/manage-windows/new-window/renderer.js
Konstantinos Ntoutsos-Oikonomou 20c910f98e docs: New fiddle example 'Create a new window' (#20480)
* add: New fiddle for Manage Windows section example

* Delete package.json

Not needed

* Address issue with .gitignore file, load new window, removing unwanted css class

* Delete package.json

* Pushing change regarding the use of shell.OpenExternal API with an event listener for the href tag on the link
2020-01-13 15:35:56 +09:00

19 lines
565 B
JavaScript

const { BrowserWindow } = require('electron').remote
const { shell } = require('electron').remote
const newWindowBtn = document.getElementById('new-window')
const link = document.getElementById('browser-window-link')
newWindowBtn.addEventListener('click', (event) => {
let win = new BrowserWindow({ width: 400, height: 320 })
win.on('close', () => { win = null })
win.loadURL('https://electronjs.org')
win.show()
})
link.addEventListener('click', (e) => {
e.preventDefault()
shell.openExternal("http://electron.atom.io/docs/api/browser-window")
})