mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2025-01-23 07:08:28 +00:00
Integrate window state manager with BrowserWindow
This commit is contained in:
parent
09777f38c8
commit
1685407e7a
@ -2,7 +2,7 @@ var path = require('path');
|
||||
var electron = require('electron');
|
||||
var helpers = require('./../../helpers/helpers');
|
||||
var createMenu = require('./../menu/menu');
|
||||
|
||||
var windowStateKeeper = require('electron-window-state');
|
||||
var BrowserWindow = electron.BrowserWindow;
|
||||
var shell = electron.shell;
|
||||
var isOSX = helpers.isOSX;
|
||||
@ -18,10 +18,16 @@ const ZOOM_INTERVAL = 0.1;
|
||||
* @returns {electron.BrowserWindow}
|
||||
*/
|
||||
function createMainWindow(options, onAppQuit, setDockBadge) {
|
||||
var mainWindowState = windowStateKeeper({
|
||||
defaultWidth: options.width || 1280,
|
||||
defaultHeight: options.height || 800
|
||||
});
|
||||
var mainWindow = new BrowserWindow(
|
||||
{
|
||||
width: options.width || 1280,
|
||||
height: options.height || 800,
|
||||
width: mainWindowState.width,
|
||||
height: mainWindowState.height,
|
||||
x: mainWindowState.x,
|
||||
y: mainWindowState.y,
|
||||
'web-preferences': {
|
||||
javascript: true,
|
||||
plugins: true,
|
||||
@ -99,6 +105,8 @@ function createMainWindow(options, onAppQuit, setDockBadge) {
|
||||
}
|
||||
});
|
||||
|
||||
mainWindowState.manage(mainWindow);
|
||||
|
||||
return mainWindow;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,6 @@ var electron = require('electron');
|
||||
var createMainWindow = require('./components/mainWindow/mainWindow');
|
||||
var createLoginWindow = require('./components/login/loginWindow');
|
||||
var helpers = require('./helpers/helpers');
|
||||
var windowStateKeeper = require('electron-window-state');
|
||||
var app = electron.app;
|
||||
var ipcMain = electron.ipcMain;
|
||||
var isOSX = helpers.isOSX;
|
||||
@ -47,12 +46,7 @@ app.on('before-quit', function () {
|
||||
});
|
||||
|
||||
app.on('ready', function () {
|
||||
var mainWindowState = windowStateKeeper({
|
||||
defaultWidth: appArgs.width || 1280,
|
||||
defaultHeight: appArgs.height || 800
|
||||
});
|
||||
mainWindow = createMainWindow(appArgs, app.quit, app.dock.setBadge);
|
||||
mainWindowState.manage(mainWindow);
|
||||
});
|
||||
|
||||
app.on('login', function(event, webContents, request, authInfo, callback) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user