Skip to content

Instantly share code, notes, and snippets.

@erickzhao
Created December 2, 2020 02:23
Show Gist options
  • Select an option

  • Save erickzhao/4e13d809f530d455a268ff9cc13a6987 to your computer and use it in GitHub Desktop.

Select an option

Save erickzhao/4e13d809f530d455a268ff9cc13a6987 to your computer and use it in GitHub Desktop.
renderer.js
<html>
<script src='./renderer.js'></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<body style="background-color:#ffff;"></body>
<div class="topnav">
<a class="active"></a>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
</div>
<div id="title=bar-btns">
<button id="close-btn" type="button" class="close" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div>
</html>
const { app, BrowserWindow } = require('electron')
function createWindow () {
const win = new BrowserWindow({
maximizable: false,
width: 520,
height: 700,
frame: false,
webPreferences: {
nodeIntegration: true
}
});
win.loadFile('index.html')
}
app.whenReady().then(createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
const remote = require('electron').remote;
document.getElementById("close-btn").addEventListener("click", function (e) {
var window = remote.getCurrentWindow();
window.close();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment