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
This commit is contained in:
Konstantinos Ntoutsos-Oikonomou 2020-01-13 07:35:56 +01:00 committed by Cheng Zhao
parent b31084493e
commit 20c910f98e
3 changed files with 100 additions and 0 deletions

View file

@ -0,0 +1,19 @@
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")
})