Example #1
0
 app.on('window-all-closed', () => {
   // if (process.platform != 'darwin')
   app.quit()
 })
Example #2
0
    global.mainWindow.on('closed', function() {
        global.mainWindow = null;

        app.quit();
    });
Example #3
0
app.on('window-all-closed', function () {
    if (process.platform !== 'darwin') {
        app.quit();
    }
});
Example #4
0
 mainWindow.on('close', function() {
   app.quit();
 });
Example #5
0
 ethereumNodes.stopNodes(function(){
     app.quit();
 });
Example #6
0
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});
	}
});
Example #7
0
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) {
Example #8
0
app.on("window-all-closed", function () {
  if (process.platform != "darwin") {
    app.quit();
  }
});
Example #9
0
ipcMain.on('quit', () => {
  app.quit();
});
Example #10
0
 app.on("window-all-closed", function() {
   app.quit();
 });
Example #11
0
 gsc.register('CmdOrCtrl+q ', function() { app.quit(); } );
Example #12
0
 { label: "Quit", accelerator: "Command+Q", click: function() { app.quit(); }}
Example #13
0
 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();
});
Example #15
0
 .then(() => {
   readyToDie = true
   app.quit()
 })
Example #16
0
 mainWindow.on('close', () => {
   app.quit();
 });
Example #17
0
 setTimeout(() => {
   readyToDie = true
   app.quit()
 }, 3000)
Example #18
0
 }, function (result) {
     if (result === 0) {
         win.destroy(); // make sure to destroy the window as otherwise quit will just not do anything
         app.quit();
     }
 });
Example #19
0
(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);
  }
})();
Example #20
0
 }, function (result) {
     app.quit();
 });
Example #21
0
   label: 'Quit', type: 'normal', accelerator: 'Command+Q', click: function () {
   app.quit();
 }
Example #22
0
 setTimeout(function () { return app.quit(); }, 0); // make sure to not run this within the callback to prevent issues
Example #23
0
app.on('window-all-closed', function() {
    app.quit();
});
Example #24
0
function quit(err) {
  if(err) console.log(err);
  mainWindow = null;
  app.quit();
}
Example #25
0
 onboardingWindow.on('close', function(){
     app.quit();
 });
app.on('window-all-closed', () => {
	if (process.platform !== 'darwin') {
		// Geth.kill();
		app.quit();
	}
});
Example #27
0
 ipcMain.on('close-main-window', function() {
     console.log('close');
     app.quit();
 });
Example #28
0
app.on('window-all-closed', () => {
  app.quit()
})
Example #29
0
 click: function () {
     app.quit();
 },
Example #30
0
 setTimeout(function() {
   app.quit();
 }, 500)