Skip to content

Commit

Permalink
Use path.join when logging screenshot path. (#29305)
Browse files Browse the repository at this point in the history
Remove index.html from offscreen-rendering tutorial.
It is not used.

Update offscreen-rendering.md to reflect changes to fiddle.

Co-authored-by: Kevin Hartman <kevin@hart.mn>
  • Loading branch information
trop[bot] and kevinhartman committed May 24, 2021
1 parent a660598 commit 1e54d19
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
15 changes: 0 additions & 15 deletions docs/fiddles/features/offscreen-rendering/index.html

This file was deleted.

3 changes: 2 additions & 1 deletion docs/fiddles/features/offscreen-rendering/main.js
@@ -1,5 +1,6 @@
const { app, BrowserWindow } = require('electron')
const fs = require('fs')
const path = require('path')

app.disableHardwareAcceleration()

Expand All @@ -12,7 +13,7 @@ app.whenReady().then(() => {
fs.writeFileSync('ex.png', image.toPNG())
})
win.webContents.setFrameRate(60)
console.log(`The screenshot has been successfully saved to ${process.cwd()}/ex.png`)
console.log(`The screenshot has been successfully saved to ${path.join(process.cwd(), 'ex.png')}`)
})

app.on('window-all-closed', () => {
Expand Down
6 changes: 1 addition & 5 deletions docs/tutorial/offscreen-rendering.md
Expand Up @@ -39,10 +39,6 @@ To enable this mode, GPU acceleration has to be disabled by calling the

## Example

Starting with a working application from the
[Quick Start Guide](quick-start.md), add the following lines to the
`main.js` file:

```javascript fiddle='docs/fiddles/features/offscreen-rendering'
const { app, BrowserWindow } = require('electron')
const fs = require('fs')
Expand All @@ -63,5 +59,5 @@ app.whenReady().then(() => {
```

After launching the Electron application, navigate to your application's
working folder.
working folder, where you'll find the rendered image.
[disablehardwareacceleration]: ../api/app.md#appdisablehardwareacceleration

0 comments on commit 1e54d19

Please sign in to comment.