-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelectron-editor.js
41 lines (34 loc) · 926 Bytes
/
electron-editor.js
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
31
32
33
34
35
36
37
38
39
40
41
const electron = require('electron');
const BrowserWindow = electron.BrowserWindow;
const Config = require('electron-store');
const app = electron.app;
const config = new Config();
let window;
function createWindow()
{
let options = { show: false };
Object.assign( options, config.get('windowBounds') );
window = new BrowserWindow( options );
window.setMenu( null );
window.loadURL( `file://${__dirname}/editor.html` );
window.once( 'ready-to-show', window.show );
//window.webContents.openDevTools()
// save window size and position
window.on( 'close', function() { config.set('windowBounds', window.getBounds()); } );
window.on( 'closed', function () { window = null; } );
}
app.on('ready', createWindow)
app.on('window-all-closed', function ()
{
if (process.platform !== 'darwin')
{
app.quit()
}
});
app.on('activate', function ()
{
if (window === null)
{
createWindow()
}
});