electronic-kit-start
Version:
Electronic kit start for devlopment on electron
47 lines (37 loc) • 1.27 kB
JavaScript
const {app, ipcMain, BrowserWindow, Tray, nativeImage} = require('electron');
//require('crash-reporter').start();
const path = require('path')
const url = require('url')
app.on('window-all-closed', function() {
if (process.platform != 'darwin') {
app.quit();
}
});
let mainWindow
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
center: true,
})
// and load the index.html of the app.
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'public/index.html'),
protocol: 'file:',
slashes: true
}))
// Open the DevTools.
mainWindow.webContents.openDevTools()
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.85
mainWindow = null
})
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)