Created
December 24, 2020 03:03
-
-
Save thatisuday/93f7d6b198f1b05d99c1c7b81ab97287 to your computer and use it in GitHub Desktop.
A simple Electron window (HTML) page.
This file contains 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 lang='en'> | |
<head> | |
<meta charset='UTF-8'> | |
<meta name='viewport' content='width=device-width, initial-scale=1.0'> | |
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" /> | |
<title>My Electron App</title> | |
<style> | |
body { | |
padding: 50px; | |
font-size: 14px; | |
background-color: #eee; | |
font-family: sans-serif; | |
text-align: center; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>Hello World!</h1> | |
<button id='btn'>Click to open a photo</button> | |
<script> | |
const { ipcRenderer } = require( 'electron' ); | |
document.getElementById( 'btn' ).onclick = function() { | |
ipcRenderer.send( 'app:display-image' ); | |
console.log( '[message sent]', 'app:display-image' ); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment