docs: add example for taking screenshot (#20531)
This commit is contained in:
parent
c73e34fb9e
commit
db91673f23
3 changed files with 93 additions and 0 deletions
25
docs/fiddles/media/screenshot/take-screenshot/main.js
Normal file
25
docs/fiddles/media/screenshot/take-screenshot/main.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
const { BrowserWindow, app } = require('electron')
|
||||
|
||||
let mainWindow = null
|
||||
|
||||
function createWindow () {
|
||||
const windowOptions = {
|
||||
width: 600,
|
||||
height: 300,
|
||||
title: 'Take a Screenshot',
|
||||
webPreferences: {
|
||||
nodeIntegration: true
|
||||
}
|
||||
}
|
||||
|
||||
mainWindow = new BrowserWindow(windowOptions)
|
||||
mainWindow.loadFile('index.html')
|
||||
|
||||
mainWindow.on('closed', () => {
|
||||
mainWindow = null
|
||||
})
|
||||
}
|
||||
|
||||
app.on('ready', () => {
|
||||
createWindow()
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue