-
-
Save erickzhao/c977efc714ed09c0c7087d8222b938b3 to your computer and use it in GitHub Desktop.
Electron Fiddle Gist
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> | |
<title>BrowserWindow</title> | |
</head> | |
<body> | |
<h1>Hello from your BrowserWindow!</h1> | |
<button></button> | |
<script> | |
document.querySelector('Close this window').onclick = () => { | |
window.close() | |
} | |
</script> | |
</body> | |
</html> |
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
// The "BrowserWindow" class is the primary way to create user interfaces | |
// in Electron. A BrowserWindow is, like the name suggests, a window. | |
// | |
// For more info, see: | |
// https://electronjs.org/docs/api/browser-window | |
const { app, BrowserWindow } = require('electron') | |
const windows = [] | |
app.on('ready', () => { | |
const w = new BrowserWindow() | |
w.on('focus', () => { | |
console.log("[FOCUS] Window focused!") | |
}) | |
w.loadFile('index.html') | |
w.setFocusable(false) | |
}) |
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
// This file is required by the index.html file and will | |
// be executed in the renderer process for that window. | |
// All of the Node.js APIs are available in this process. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment