docs: add exemplary fiddle for launch in fiddle
feat (#19759)
* add fit-screen * new url format * nit
This commit is contained in:
parent
db21391156
commit
e59095423e
2 changed files with 21 additions and 1 deletions
|
@ -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
|
||||
|
|
20
docs/fiddles/screen/fit-screen/main.js
Normal file
20
docs/fiddles/screen/fit-screen/main.js
Normal 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')
|
||||
})
|
Loading…
Reference in a new issue