Skip to content

Instantly share code, notes, and snippets.

@converge
Created October 9, 2018 01:28
Show Gist options
  • Save converge/db9f9e0bf4c85b13cd2dbd8a9f0cf1ea to your computer and use it in GitHub Desktop.
Save converge/db9f9e0bf4c85b13cd2dbd8a9f0cf1ea to your computer and use it in GitHub Desktop.
#
# MAIN.JS
#
const { app, BrowserWindow } = require('electron')
require('electron-reload')
let win
function createWindow() {
win = new BrowserWindow( {width: 800, height: 600})
win.loadFile('index.html')
win.webContents.openDevTools()
win.on('closed', () => {
win = null
})
}
app.on('ready', createWindow)
app.on('window-all-closed', () => {
if (process.platform != 'Darwin') {
app.quit()
}
})
app.on('active', () => {
if (win == null) {
createWindow()
}
})
#
# HTML
#
<button class="nav-link active" id="login_window" role="tab" data-toggle="tab">
<i class="material-icons">account_circle</i>
Login
</button>
#
# actions.js
#
const login_window = document.getElementById('login_window')
login_window.addEventListener('click', function(event) {
console.log('okkk1')
win.loadFile('index2.html')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment