42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
var app = require('app'); // Module to control application life.
|
|
var BrowserWindow = require('browser-window'); // Module to create native browser window.
|
|
var isDev = process.env.NODE_ENV === 'development';
|
|
var constants = require('./'+(isDev ? 'js': 'js-compiled')+'/util/const');
|
|
|
|
var mainWindow = null;
|
|
|
|
// Quit when all windows are closed.
|
|
app.on('window-all-closed', function() {
|
|
app.quit();
|
|
});
|
|
|
|
app.on('ready', function() {
|
|
// Create the browser window.
|
|
var electronScreen = require('screen');
|
|
var size = electronScreen.getPrimaryDisplay().workAreaSize;
|
|
|
|
var asDesktop = process.env.PITAYA_AS_DESKTOP == 1;
|
|
|
|
mainWindow = new BrowserWindow({
|
|
type: asDesktop ? 'desktop' : undefined,
|
|
'skip-taskbar': asDesktop,
|
|
frame: !asDesktop,
|
|
width: asDesktop ? size.width : undefined,
|
|
height: asDesktop ? size.height : undefined,
|
|
x: asDesktop ? 0 : undefined,
|
|
y: asDesktop ? 0 : undefined,
|
|
});
|
|
|
|
if(process.env.NODE_ENV === 'development') {
|
|
mainWindow.openDevTools();
|
|
}
|
|
|
|
// and load the index.html of the app.
|
|
mainWindow.loadUrl('file://' + __dirname + '/index.html');
|
|
|
|
mainWindow.on('closed', function() {
|
|
mainWindow = null;
|
|
});
|
|
|
|
});
|