app.on('window-all-closed', () => { // if (process.platform != 'darwin') app.quit() })
global.mainWindow.on('closed', function() { global.mainWindow = null; app.quit(); });
app.on('window-all-closed', function () { if (process.platform !== 'darwin') { app.quit(); } });
mainWindow.on('close', function() { app.quit(); });
ethereumNodes.stopNodes(function(){ app.quit(); });
app.on('ready', function() { var config = 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: path.join(__dirname, 'icon.png'), transparent: false, frame: true, 'web-preferences' : { 'experimental-features' : true } }); var menu = new Mnu(); menu.init(mainWindow); mainWindow.maximize(); mainWindow.on('closed', function() { mainWindow = null; }); var devtoolsClosedFirstCall = true; // workaround - devtools-closed fired once devTools was opened? mainWindow.on('devtools-closed', function() { if (config.settings.app.hideMainWindow){ if (!devtoolsClosedFirstCall){ mainWindow.close(); } } devtoolsClosedFirstCall = false; }); mainWindow.on('devtools-opened', function() { setTimeout(function(){ mainWindow.loadURL('file://' + __dirname + '/index.html'); if (config.settings.app.hideMainWindow){ mainWindow.hide(); } }, 400); }); mainWindow.openDevTools({detach : config.settings.app.openDevToolsDetached}); } });
var iShouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory) { var uri = ""; if (commandLine.length == 2) { uri = commandLine[1]; openURL(uri); } if (mainWindow) { if (mainWindow.isMinimized()) mainWindow.restore(); mainWindow.show(); mainWindow.focus(); } return true; }); if (iShouldQuit) app.quit(); // Quit when all windows are closed. app.on('window-all-closed', function() { // On OS X it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q if (platform != 'mac') { app.quit(); } }); // You can use 'before-quit' instead of (or with) the close event app.on('before-quit', function () { // Handle menu-item or keyboard shortcut quit here console.log('Closing Application'); if (launched_from_installer) {
app.on("window-all-closed", function () { if (process.platform != "darwin") { app.quit(); } });
ipcMain.on('quit', () => { app.quit(); });
app.on("window-all-closed", function() { app.quit(); });
gsc.register('CmdOrCtrl+q ', function() { app.quit(); } );
{ label: "Quit", accelerator: "Command+Q", click: function() { app.quit(); }}
c.on('end', function() { app.quit(); });
app.on('window-all-closed', function () { console.log('You are running on the following platform:', process.platform); //if (process.platform !== 'darwin') app.quit(); });
.then(() => { readyToDie = true app.quit() })
mainWindow.on('close', () => { app.quit(); });
setTimeout(() => { readyToDie = true app.quit() }, 3000)
}, function (result) { if (result === 0) { win.destroy(); // make sure to destroy the window as otherwise quit will just not do anything app.quit(); } });
(function() { // Define the CLI arguments and parse them const cliArgs = process.argv.slice(1, process.argv.length); const options = yargs(cliArgs) .usage('Usage: $0 [options]') .option('os-startup', { type: 'boolean', description: 'Flag to indicate the app is being run by the OS on startup.' }) .option('portable', { type: 'boolean', description: 'Run in portable mode.' }) .option('debug', { type: 'boolean', description: 'Run in debug mode.' }) .option('repl', { type: 'boolean', description: 'Listen for REPL connections on port 3499.' }) .option('mas', { type: 'boolean', description: 'Run in Mac App Store release mode.' }) .option('version', { type: 'boolean', description: 'Print the app version.', alias: 'v' }) .option('squirrel-install', { type: 'boolean', description: 'Squirrel.Windows flag, called when the app is installed.' }) .option('squirrel-uninstall', { type: 'boolean', description: 'Squirrel.Windows flag, called after the app is updated.' }) .option('squirrel-updated', { type: 'boolean', description: 'Squirrel.Windows flag, called when the app is uninstalled.' }) .option('squirrel-obsolete', { type: 'boolean', description: 'Squirrel.Windows flag, called before updating to a new version.' }) .option('squirrel-firstrun', { type: 'boolean', description: 'Squirrel.Windows flag, called only once after installation.' }) .help('help', 'Print this help message.').alias('help', 'h') .epilog('Coded with <3 by ' + manifest.author) .argv; global.manifest = manifest; global.options = options; options.mas = options.mas || !!process.mas; options.portable = options.portable || !!manifest.portable; options.debug = options.debug || !!process.env.DEBUG; // Force-enable debug if (options.debug && !process.env.DEBUG) { debug.enable(manifest.name + ':*'); } log('cli args parsed', options); if (options.debug) { log('debug mode enabled'); } // Change the userData path if in portable mode if (options.portable) { log('running in portable mode'); const userDataPath = path.join(filePaths.getAppDir(), 'data'); log('set userData path', userDataPath); app.setPath('userData', userDataPath); } // Import prefs now so the correct userData path is used const prefs = require('./utils/prefs').default; // Check for Squirrel.Windows CLI args if (process.platform == 'win32') { const SquirrelEvents = require('./components/squirrel-events').default; if (SquirrelEvents.check(options)) { log('Squirrel.Windows event detected'); return; } } // Quit the app immediately if this pref is set if (prefs.get('launch-quit')) { log('launch-quit pref is true, quitting'); prefs.unsetSync('launch-quit'); return app.quit(); } // Print the version and exit if (options.version) { console.log(`${app.getName()} ${app.getVersion()}`); console.log(`Electron ${process.versions.electron}`); console.log(`Chromium ${process.versions.chrome}`); return app.quit(); } // Enforce single instance const isDuplicateInstance = app.makeSingleInstance(() => { if (global.application) { const mainWindow = global.application.mainWindowManager.window; if (mainWindow) { if (mainWindow.isMinimized()) { mainWindow.restore(); } mainWindow.focus(); } } return true; }); if (isDuplicateInstance) { log('another instance of the app is already running'); return app.quit(); } // Enable the crash reporter if (!options.mas) { if (manifest.crashReporter && manifest.crashReporter.url) { if (prefs.get('analytics-track')) { app.on('will-finish-launching', function() { log('will finish launching'); // Crash reporter const reporterOptions = { productName: manifest.productName, companyName: manifest.win.companyName, submitURL: manifest.crashReporter.url, autoSubmit: true }; log('starting crash reporter', JSON.stringify(reporterOptions)); const CrashReporter = require('crash-reporter'); CrashReporter.start(reporterOptions); }); } else { log('analytics disabled, so crash reporter disabled'); } } else { log('crash reporter url not configured'); } } else { log('mas release, crash reporter disabled'); } // Create the main app object and init app.on('ready', function() { log('ready, launching app'); const Application = require('./application').default; global.application = new Application(manifest, options); global.application.init(); global.ready = true; }); // If the REPL is enabled, launch it if (options.repl) { require('./utils/repl').createServer(3499); } })();
}, function (result) { app.quit(); });
label: 'Quit', type: 'normal', accelerator: 'Command+Q', click: function () { app.quit(); }
setTimeout(function () { return app.quit(); }, 0); // make sure to not run this within the callback to prevent issues
app.on('window-all-closed', function() { app.quit(); });
function quit(err) { if(err) console.log(err); mainWindow = null; app.quit(); }
onboardingWindow.on('close', function(){ app.quit(); });
app.on('window-all-closed', () => { if (process.platform !== 'darwin') { // Geth.kill(); app.quit(); } });
ipcMain.on('close-main-window', function() { console.log('close'); app.quit(); });
app.on('window-all-closed', () => { app.quit() })
click: function () { app.quit(); },
setTimeout(function() { app.quit(); }, 500)