-
-
Save codebytere/62ab485318c3dbce70b4232b3f18053e to your computer and use it in GitHub Desktop.
Electron Fiddle Gist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Hello World!</title> | |
| <link rel="stylesheet" type="text/css" href="./styles.css"> | |
| </head> | |
| <body> | |
| <h1>Hello World!</h1> | |
| <!-- All of the Node.js APIs are available in this renderer process. --> | |
| We are using Node.js <script>document.write(process.versions.node)</script>, | |
| Chromium <script>document.write(process.versions.chrome)</script>, | |
| and Electron <script>document.write(process.versions.electron)</script>. | |
| <script> | |
| // You can also require other files to run in this process | |
| require('./renderer.js') | |
| </script> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const {app, BrowserWindow} = require('electron'); | |
| function createWindow() { | |
| const win = new BrowserWindow({ | |
| width: 800, | |
| height: 600, | |
| webPreferences: { | |
| nodeIntegration: true | |
| } | |
| }); | |
| win.loadFile('index.html'); | |
| win.webContents.openDevTools(); | |
| } | |
| app.whenReady().then(createWindow); | |
| app.allowRendererProcessReuse = true; | |
| app.on('window-all-closed', () => { | |
| if (process.platform !== 'darwin') { | |
| app.quit(); | |
| } | |
| }); | |
| app.on('activate', () => { | |
| if (BrowserWindow.getAllWindows().length === 0) { | |
| createWindow(); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Empty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (async () => { | |
| const fs = require('fs').promises; | |
| for (let i = 0; i < 10; i++) { | |
| let list = await fs.readdir('.', {withFileTypes: true}); | |
| for (let file of list) { | |
| if (file.isFile()) { | |
| console.log('Reading file', file.name); | |
| await fs.readFile(file.name, 'utf-8'); | |
| } | |
| } | |
| } | |
| console.log('done'); | |
| })(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Empty */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment