-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
30 lines (23 loc) · 942 Bytes
/
main.js
File metadata and controls
30 lines (23 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var electron = require('electron');
const app = electron.app
const BrowserWindow = electron.BrowserWindow
// referência global para manter a instância da janela até que sejam fechadas pelo usuário então ele irá ser fechado quando o JavaScript fizer Garbage collection
var mainWindow = null;
// Sair da aplicação quando todas as janelas forem fechadas
app.on('window-all-closed', function() {
if (process.platform != 'darwin') {
app.quit();
}
});
app.on('ready', function() {
// Cria a janela do browser.
mainWindow = new BrowserWindow({width: 1400, height: 700});
// Carrega o arquivo html principal.
mainWindow.loadURL('file://' + __dirname + '/index.html');
// aber o DevTools. (console, inspecionar elemento, etc)
mainWindow.webContents.openDevTools();
// Evento emitido quando a janela é fechada, usado para destruir instancia.
mainWindow.on('closed', function() {
mainWindow = null;
});
});