initial commit
This commit is contained in:
45
index.js
Normal file
45
index.js
Normal file
@@ -0,0 +1,45 @@
|
||||
var electron = require('electron')
|
||||
var app = electron.app
|
||||
|
||||
// report crashes to the Electron project
|
||||
require('crash-reporter').start()
|
||||
|
||||
// adds debug features like hotkeys for triggering dev tools and reload
|
||||
require('electron-debug')()
|
||||
|
||||
// prevent window being garbage collected
|
||||
var mainWindow
|
||||
|
||||
function onClosed () {
|
||||
// dereference the window
|
||||
// for multiple windows store them in an array
|
||||
mainWindow = null
|
||||
}
|
||||
|
||||
function createMainWindow () {
|
||||
const win = new electron.BrowserWindow({
|
||||
width: 600,
|
||||
height: 400
|
||||
})
|
||||
|
||||
win.loadURL('file://' + __dirname + '/index.html')
|
||||
win.on('closed', onClosed)
|
||||
|
||||
return win
|
||||
}
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (!mainWindow) {
|
||||
mainWindow = createMainWindow()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('ready', () => {
|
||||
mainWindow = createMainWindow()
|
||||
})
|
||||
Reference in New Issue
Block a user