Skip to content

Commit

Permalink
docs: add exemplary fiddle for launch in fiddle feat (#19759)
Browse files Browse the repository at this point in the history
* add fit-screen

* new url format

* nit
  • Loading branch information
Micha Hanselmann authored and MarshallOfSound committed Aug 15, 2019
1 parent db21391 commit e590954
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/api/screen.md
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions docs/fiddles/screen/fit-screen/main.js
@@ -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')
})

0 comments on commit e590954

Please sign in to comment.