app.on("ready", function() { // create main window // ref. https://github.com/atom/electron/blob/master/docs/api/browser-window.md mainWindow = new BrowserWindow({ width: 800, height: 600, center: true, resizable: true, frame: true, transparent: false, }); // hide default menubar mainWindow.setMenu(null); // load homepage var homepageUrl = "file://" + __dirname + "/index.html"; mainWindow.loadUrl(homepageUrl); // open Chromium DevTools mainWindow.openDevTools(); mainWindow.on("closed", function() { mainWindow = null; }); });
app.on('ready', function() { var atomScreen = require('screen'), size = atomScreen.getPrimaryDisplay().workAreaSize; // CREATE THE WINDOW BROWSER AND SETTINGS var mainOptions = { width: size.width, height: size.height, icon: '/assets/images/window.png' }; mainWindow = new BrowserWindow(mainOptions); // LOAD APP URL mainWindow.loadUrl('file://' + __dirname + '/index.html'); // DESTROY WINDOW WHEN CLOSED mainWindow.on('closed', function() { mainWindow = null; }); // DEBUG APPLICATION if (process.env.NODE_ENV !== 'production') { mainWindow.openDevTools() } });
app.on("ready", function () { // Create the browser window. mainWindow = new BrowserWindow({ width: 1160, height: 600, frame: false, title: app.getName() }); // and load the index.html of the app. mainWindow.loadUrl("file://" + __dirname + "/index.html"); // mainWindow.loadUrl("http://hikar.io/test.html"); // Open the DevTools. mainWindow.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. mainWindow = null; }); });
function createMainWindow () { var win = new BrowserWindow({ title: 'Web App', width: 800, height: 600, center: true, show: false, frame: frame, resizable: true, 'min-width': 600, 'min-height': 500, 'web-preferences': { 'overlay-scrollbars': true }, 'enable-larger-than-screen': true, transparent: true }); win.loadUrl('file://' + __dirname + pathToLoad); if(process.env.NODE_ENV === "devtools") { win.openDevTools({detach: true}); } win.on('closed', onClosed); return win; }
app.on( 'ready' , function() { // Create the browser window. mainWindow = new BrowserWindow( { width: 830 , height: 480 } ) ; // Open dev tools? if ( devTools ) { mainWindow.openDevTools() ; } mainWindow.command = { path: args[ 2 ] , args: args.slice( 3 ) } ; mainWindow.childProcess = ChildProcess.create( args[ 2 ] , args.slice( 3 ) ) ; // and load the index.html of the app. mainWindow.loadUrl( 'file://' + __dirname + '/front/terminal.html' ) ; // 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. mainWindow = null ; } ) ; } ) ;
app.on('ready', function() { var myScreen = require('screen'); var size = myScreen.getPrimaryDisplay().workAreaSize; mainWindow = new BrowserWindow({ width: size.width, height: size.height/2, frame: false, "skip-taskbar": true, resizable: false, transparent: true }); mainWindow.loadUrl('file://' + __dirname + '/main.html'); mainWindow.show(); mainWindow.openDevTools(); mainWindow.on('closed', function() { mainWindow = null; }); var icon = NativeImage.createFromPath(__dirname.slice(2) + '/css/tray.png'); mainTray = new Tray(icon); var contextMenu = Menu.buildFromTemplate([ { label: 'Quit', type: 'normal', click: function() {mainWindow.close();} } ]); mainTray.setToolTip('This is my application.'); mainTray.setContextMenu(contextMenu); });
app.on('ready', function () { var appRoot = path.join(__dirname, '.'); require('electron-compile').init(appRoot, './main'); // 创建浏览器窗口。 mainWindow = new BrowserWindow({ width: 800, height: 600, icon: __dirname + '/app/img/favicon.ico', // title: '这是标题' // fullscreen: true // frame: false }); // 加载应用的 index.html mainWindow.loadURL('file://' + __dirname + '/app/index.html'); // mainWindow.loadURL('http://www.baidu.com'); // 打开开发工具 mainWindow.openDevTools(); // 当 window 被关闭,这个事件会被发出 mainWindow.on('closed', function() { // 取消引用 window 对象,如果你的应用支持多窗口的话, // 通常会把多个 window 对象存放在一个数组里面, // 但这次不是。 mainWindow = null; }); client.create(mainWindow); // livereload.client(mainWindow); });
app.on('ready', function () { mainWindow = new BrowserWindow({ width: 1200, height: 800, icon: path.join(__dirname, "/icon.png"), "node-integration": false }) mainWindow.openDevTools() mainWindow.loadUrl('http://192.168.1.170:32400/web') mainWindow.webContents.on('did-finish-load', function () { var self = this self.executeJavaScript('(' + function () { var chk = setInterval(function () { var el if ((el = $('#plex > div.side-bar.dark-scrollbar > div.dashboard-servers-container > ul > li > ul > li:contains("Music") > a span')).is(':visible')) { el[0].click() clearInterval(chk) } }, 100) } + ')()') }) globalShortcut.register('MediaPlayPause', ExecFunction(PlayPause)) globalShortcut.register('MediaNextTrack', ExecFunction(Next)) globalShortcut.register('MediaPreviousTrack', ExecFunction(Prev)) mainWindow.on('closed', function () { mainWindow = null }) })
app.on('ready',function(){ //创建一个窗口 var mainWindow=new BrowserWindow({ width:800, height:600 }); //将网页加入创建的窗口 mainWindow.loadURL('file://'+__dirname+'/main.html'); //显示调试模式 mainWindow.openDevTools(); var profileWindow=new BrowserWindow({ width:500, height:500, show:false }); profileWindow.loadURL('file://'+__dirname+'/profile.html'); //通过ipc消息方式显示profile窗口 ipc.on('show-profile',function(){ profileWindow.show(); }); //通过ipc消息方式隐藏 ipc.on('hide-profile',function(){ profileWindow.hide(); }); });
app.on('ready', function() { // Create the browser window. mainWindow = new BrowserWindow({width: 1200, height: 1000}); // and load the index.html of the app. mainWindow.loadUrl('file://' + __dirname + '/index.html'); mainWindow.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. /* // Saving data on localStorage //angular.element(html).scope(); var ipc = require('ipc'); //window.webContents.on('did-finish-load', function() { mainWindow.webContents.send('ping', 'whoooooooh!'); // }); localStorage.setItem("activities", JSON.stringify($scope.activities)); console.log(localStorage.getItem("activities")); //fs.writeFileSync('./data.json', window.MY_SCOPE.join(',') , 'utf-8'); //JSON.stringify(obj) */ mainWindow = null; }); });
app.on('ready', function () { // Create the browser window. mainWindow = new BrowserWindow({ width: 1000, height: 1000, 'min-width': 1000, 'min-height': 1000, 'accept-first-mouse': true, 'title-bar-style': 'hidden' }); mainWindow.maximize(); // and load the index.html of the app. mainWindow.loadURL('file://' + __dirname + '/index.html'); // Open the DevTools. mainWindow.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. mainWindow = null; }); });
app.on('ready', function() { // Create the browser window. mainWindow = new BrowserWindow({width: 1024, height: 768}); //mainWindow = new BrowserWindow({kiosk:true}); //https://github.com/atom/electron/blob/master/docs/api/browser-window.md // and load the index.html of the app. mainWindow.loadURL('file://' + __dirname + '/web/index.html'); /**** paso de parámetros a l lado del renderer ***/ if(! (process.argv[2]==undefined) ){ // 2 parametros ya por defecto vamos a por el 3º console.log(process.argv[2]) // el primer parametro extra lo consideramos el nombre de la playlist. Ruta absoluta var webContents = mainWindow.cmdParameterJSONFile=process.argv[2] } // Open the devtools. mainWindow.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. mainWindow = null; }); });
server.addMethod('BrowserWindow-new', function(param, callback) { param = param || {}; var x = param.x || 0; var y = param.y || 0; var width = param.width || 1024; var height = param.height || 768; var dev_tools_enabled = param.dev_tools_enabled || false; var show = param.show || false; var frame = param.frame || false; var kiosk = param.kiosk || false; // Create the browser window. var win = new BrowserWindow({ "x" : x, "y" : y, "width" : width, "height" : height, "show" : show, "frame" : frame, "kiosk" : kiosk, }); var currentHandle = ++handle; handleStore[handle] = win; // Open the devtools. if(dev_tools_enabled) { win.openDevTools(); } callback(0, currentHandle); });
export function buildNewWindow(app) { windowsNumber += 1; const mainWindow = new BrowserWindow({ title: productName, icon: resolve(__dirname, '..', '..', 'resources', 'app.png'), width: 1024, height: 700, minWidth: 512, minHeight: 350, }); attachMenuToWindow(app, buildNewWindow); // and load the index.html of the app. const entryBasePath = devMode ? 'http://localhost:8080' : ('file://' + resolve(__dirname, '..')); mainWindow.loadURL(entryBasePath + '/static/index.html'); // Emitted when the window is closed. mainWindow.on('closed', () => delete WINDOWS[windowsNumber]); if (devMode) { mainWindow.openDevTools(); } checkUpdate(mainWindow) .catch(err => console.error('Unable to check for updates', err)); }
app.on('ready', function () { mainWindow = new BrowserWindow({ x: mainWindowState.x, y: mainWindowState.y, width: mainWindowState.width, height: mainWindowState.height, preload: __dirname + '/splash/splash.js', show:false }); if (mainWindowState.isMaximized) { mainWindow.maximize(); } mainWindow.loadUrl('file://' + __dirname + '/index.html'); if (env.name === 'development') { devHelper.setDevMenu(); mainWindow.openDevTools(); } mainWindow.webContents.on('did-finish-load', function() { setTimeout(function(){ mainWindow.webContents.send('splashclose', 'splashclose!!'); mainWindow.show(); }, 2000); }); mainWindow.on('close', function () { mainWindowState.saveState(mainWindow); }); });
gui.on('ready', function() { // Disable fullscreen if we are in debug. if (pjson.debug) { pjson.window.fullscreen = false; } // Create the browser window. mainWindow = new BrowserWindow({ title: pjson.window.title, width: pjson.window.width, height: pjson.window.height, fullscreen: pjson.window.fullscreen, icon: pjson.window.icon, 'web-preferences': { 'plugins': true } }); // and load the index.html of the gui. mainWindow.loadUrl('file://' + __dirname + '/index.html'); // Open the devtools if we are in debug. if (pjson.debug) { mainWindow.openDevTools(); } // Emitted when the window is closed. mainWindow.on('closed', function() { mainWindow = null; }); });
app.on('ready', function () { mainWindow = new BrowserWindow({ x: mainWindowState.x, y: mainWindowState.y, width: mainWindowState.width, height: mainWindowState.height }); if (mainWindowState.isMaximized) { mainWindow.maximize(); } if (env.name === 'test') { mainWindow.loadUrl('file://' + __dirname + '/spec.html'); } else { mainWindow.loadUrl('file://' + __dirname + '/app.html'); } if (env.name !== 'production') { devHelper.setDevMenu(); mainWindow.openDevTools(); } mainWindow.on('close', function () { mainWindowState.saveState(mainWindow); }); });
const launchMainWindow = () => { mainWindow = new BrowserWindow({ width: 800, height: 600 }) // mainWindow.maximize(); mainWindow.loadUrl('file://' + __dirname + '/../renderer/index.html') mainWindow.openDevTools() mainWindow.on('closed', () => (mainWindow = null)) }
app.on('ready', function() { // Create the browser window. mainWindow = new BrowserWindow({width: 800, height: 600}); // and load the index.html of the app. mainWindow.loadUrl('file://' + __dirname + '/index.html'); // 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. mainWindow = null; }); mainWindow.openDevTools({ detach: true }); /* setWindow = new BrowserWindow({width: 800, height: 600}); setWindow.loadUrl('file://' + __dirname + '/set.html'); setWindow.on('closed', function() { setWindow = null; }); setWindow.openDevTools({ detach: true });*/ });
app.on('ready', function() { // Create the browser window. mainWindow = new BrowserWindow({width: 800, height: 600}); // If NODE_ENV environment variable is not production, assume dev var development = process.env.NODE_ENV !== 'production'; var url = 'file://' + __dirname + '/index.html' console.log('loading ' + url); mainWindow.loadUrl(url); // Launch chrome dev tools in dev if (development) { mainWindow.openDevTools(['detach']); } // 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. mainWindow = null; }); });
app.on('ready', function() { var firstStart = true; ipc.on('is-iron-node-first-start', function(event/*, arg*/) { event.sender.send("is-iron-node-first-start-asynchronous-reply", {firstStart:firstStart}); firstStart = false; }); initializeApplication(); var meta = require("./../package.json"); var program = require('commander'); program.version(meta.version).allowUnknownOption() .option('-c, --compile [value]', 'recompile native modules for current electron version and processor architecture') .parse(process.argv); if (program.compile){ var recompiler = require("./../node_modules/electron-recompile/lib/recompiler.js"); var targetFolder = program.compile; if (targetFolder.toString().toLowerCase() === "true"){ targetFolder = process.cwd(); } recompiler.run({ dir : targetFolder, electronVersion : process.versions.electron, arch : process.arch }); app.quit(); process.exit(0); } else { mainWindow = new BrowserWindow({ width: 800, height: 600, title : "ironNode v" + meta.version, icon: __dirname + '/icon.png', transparent: false, frame: true, 'web-preferences' : { 'experimental-features' : true } }); toaster.init(mainWindow); mainWindow.maximize(); mainWindow.openDevTools(); mainWindow.on('closed', function() { mainWindow = null; }); mainWindow.on('devtools-opened', function() { mainWindow.loadUrl('file://' + __dirname + '/index.html'); }); } });
app.on('ready', function (){ var mainWindow = new BrowserWindow({ width: 800, height:600 }) mainWindow.loadURL('file:\\' + __dirname + '/index.html') mainWindow.openDevTools() })
app.on('ready', function () { mainWindow = new BrowserWindow({width: 800, height: 600}) mainWindow.loadUrl('file://' + __dirname + '/app/index.html') mainWindow.openDevTools() mainWindow.on('closed', function () { mainWindow = null }) ipc.on('turnOnServer', function (e) { console.log('requested turn on') server.turnOn() e.sender.send('serverTurnedOn') }) ipc.on('turnOffServer', function (e) { console.log('requested turn off') server.turnOff() e.sender.send('serverTurnedOff') }) ipc.on('checkServerStatus', function (e) { e.returnValue = server.checkStatus() }) var status = {} status.watcher = null status.filename = '' ipc.on('watchFile', function (e, filename) { status.filename = filename cp.exec('git init', {cwd: status.filename}, function (err, stdout, stderr) { console.log(stdout.toString('utf-8')) if (status.watcher) status.watcher.close() status.watcher = fs.watch(status.filename, { persistent: true, recursive: false }, function (e, file) { console.log('CHANGED :', file) cp.exec('git add -A', {cwd: status.filename}, function (err, stdout, stderr) { console.log(stdout.toString('utf-8')) cp.exec('git commit -a -m yolo', {cwd: status.filename}, function (err, stdout, stderr) { console.log(stdout.toString('utf-8')) cp.exec('git push http://localhost:8080/git/index master', {cwd: status.filename}, function (err, stdout, stderr) { console.log(stdout.toString('utf-8')) }) }) }) }) }) }) ipc.on('requestPull', function () { cp.exec('git pull http://localhost:8080/git/index', {cwd: status.filename}, function (err, stdout, stderr) { console.log(stdout.toString('utf-8')) console.log('ERR:', stderr.toString('utf-8')) }) }) })
handleEvents() { this.browserWindow.openDevTools(); // quit when window close this.browserWindow.on('closed', () => { this.browserWindow = null; }); this.browserWindow.webContents.on('did-finish-load', () => { global.Application.sendData('titles'); }); }
function openConfig() { configWindow = new BrowserWindow({width: 1024, height: 768}); configWindow.loadUrl('file://' + path.resolve(__dirname, '../index.html')); configWindow.openDevTools(); configWindow.on('closed', function() { configWindow = null; }); }
app.on('ready', function () { var mainWindow = new BrowserWindow({ width : 1360, height: 800, }); mainWindow.loadURL('file://' + __dirname + '/public/index.html'); mainWindow.openDevTools(); mainWindow.on('closed', function () { mainWindow = null; }); ////////////////////// ////////// WORKER WINDOW ////////////////////// // var workerWindow = new BrowserWindow({ // width : 600, // height: 800, // }); // workerWindow.loadURL('file://' + __dirname + '/public/worker.html'); // workerWindow.openDevTools(); // workerWindow.on('closed', function () // { // workerWindow = null; // }); // ipcMain.on('action', function (event, arg) // { // // console.log(arg) // if (arg.target === 'worker') // { // console.log('main -> ' + arg.target + ': ' + arg.type); // workerWindow.webContents.send('action', arg) // } // else if (arg.target === 'main') // { // console.log('worker -> ' + arg.target + ': ' + arg.type); // mainWindow.webContents.send('action', arg) // } // }); });
app.on('ready', function() { mainWindow = new BrowserWindow({width: 1360, height: 800}); mainWindow.loadUrl('file://' + __dirname + '/static/index.html'); mainWindow.openDevTools(); mainWindow.on('closed', function() { mainWindow = null; }); });
app.on('ready', function() { //mainWindow = new BrowserWindow({width: 800, height: 600}); mainWindow = new BrowserWindow({width: 1800, height: 1600}); mainWindow.loadUrl('file://' + __dirname + '/app/app.html'); mainWindow.openDevTools(); mainWindow.on('closed', function() { mainWindow = null; }); });
app.on('ready', function() { mainWindow = new BrowserWindow({width: 1200, height: 800}); mainWindow.loadUrl(`file://${__dirname}/electron-index.html`); mainWindow.openDevTools(); 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. mainWindow = null; }); });
app.on('ready', function() { mainWindow = new BrowserWindow({ height: 300, minHeight: 300, width: 800, minWidth: 800, resizable: true }); mainWindow.loadURL('file://' + __dirname + '/app/index.html'); mainWindow.openDevTools(); });