Created
March 27, 2019 17:19
-
-
Save MarshallOfSound/c89aa0037c3da114d44aa3a2d1a0fc24 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> | |
</head> | |
<body> | |
<h1>Hello World!</h1> | |
</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, ipcMain} = require('electron') | |
let mainWindow | |
ipcMain.on('ping', (event, ...args) => console.log('pong', ...args)) | |
function createWindow () { | |
// Create the browser window. | |
mainWindow = new BrowserWindow({ | |
width: 800, | |
height: 600, | |
webPreferences: { | |
nodeIntegration: true, | |
preload: require('path').resolve(__dirname, 'renderer.js') | |
} | |
}) | |
// and load the index.html of the app. | |
mainWindow.loadURL('https://google.com') | |
setTimeout(() => { | |
mainWindow.loadURL('https://google.com') | |
}, 2000); | |
setTimeout(() => { | |
mainWindow.loadURL('https://google.com') | |
}, 4000); | |
} | |
app.on('ready', createWindow) | |
app.on('window-all-closed', function () { | |
app.quit() | |
}) |
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
require('electron').ipcRenderer.send('ping', 'before loop', process.pid); | |
const now = Date.now(); | |
while (Date.now() - now < 7000) { | |
} | |
require('electron').ipcRenderer.send('ping', 'after loop', process.pid); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment