docs: add exemplary fiddle for launch in fiddle feat (#19759)

* add fit-screen

* new url format

* nit
This commit is contained in:
Micha Hanselmann 2019-08-15 15:37:37 -07:00 committed by Samuel Attard
parent db21391156
commit e59095423e
2 changed files with 21 additions and 1 deletions

View file

@ -14,7 +14,7 @@ property, so writing `let { screen } = require('electron')` will not work.
An example of creating a window that fills the whole screen:
```javascript
```javascript fiddle='docs/fiddles/screen/fit-screen'
const { app, BrowserWindow, screen } = require('electron')
let win

View file

@ -0,0 +1,20 @@
// Retrieve information about screen size, displays, cursor position, etc.
//
// For more info, see:
// https://electronjs.org/docs/api/screen
const { app, BrowserWindow } = require('electron')
let mainWindow = null
app.on('ready', () => {
// We cannot require the screen module until the app is ready.
const { screen } = require('electron')
// Create a window that fills the screen's available work area.
const primaryDisplay = screen.getPrimaryDisplay()
const { width, height } = primaryDisplay.workAreaSize
mainWindow = new BrowserWindow({ width, height })
mainWindow.loadURL('https://electronjs.org')
})