Skip to content

Instantly share code, notes, and snippets.

@erickzhao
Last active July 2, 2019 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erickzhao/c977efc714ed09c0c7087d8222b938b3 to your computer and use it in GitHub Desktop.
Save erickzhao/c977efc714ed09c0c7087d8222b938b3 to your computer and use it in GitHub Desktop.
Electron Fiddle Gist
<!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>
// 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 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