How to use the electron-util.is.development function in electron-util

To help you get started, we’ve selected a few electron-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github atomiclabs / hyperdex / app / marketmaker / index.js View on Github external
currency = _.omit(currency, ['electrumServers']);

			// Translate to exepcted mm v2 format
			currency.etomic = currency.contractAddress;
			delete currency.contractAddress;

			return currency;
		});

		options = {
			...options,
			gui: 'hyperdex',
			userhome: os.homedir(),
			netid: 9999, // TODO: Set this to `0` when mm v2 is production ready
			rpcport: port,
			rpccors: is.development ? 'http://localhost:8080' : 'app://-',
			coins,
		};

		this.port = options.rpcport;

		if (options.seedPhrase) {
			// eslint-disable-next-line camelcase
			options.rpc_password = await sha256(options.seedPhrase);
			options.passphrase = options.seedPhrase;
			delete options.seedPhrase;
		} else {
			throw new Error('The `seedPhrase` option is required');
		}

		// NOTE: It's very important that this is a different directory than mm v1, as the database is not compatible
		// TODO: Update the path here when mm v2 is production ready
github atomiclabs / hyperdex / app / menu.js View on Github external
const createHelpMenu = () => {
	const helpSubmenu = [
		{
			label: t('help.debugMode'),
			type: 'checkbox',
			checked: isDevelopment,
			enabled: !isNightlyBuild && !is.development, // Enable it only in production
			click() {
				config.set('isDebugMode', !isDevelopment);
				app.relaunch();
				app.quit();
			},
		},
		{
			type: 'separator',
		},
		openUrlMenuItem({
			label: t('help.website'),
			url: websiteUrl,
		}),
		openUrlMenuItem({
			label: t('help.sourceCode'),
			url: repoUrl,
github timche / gmail-desktop / src / menu.ts View on Github external
)
        }
      },
      {
        label: 'View Logs',
        visible: config.get(ConfigKey.DebugMode),
        click() {
          viewLogs()
        }
      }
    ]
  }
]

// Add the develop menu when running in the development environment
if (is.development) {
  applicationMenu.splice(-1, 0, {
    label: 'Develop',
    submenu: [
      {
        label: 'Clear Cache and Restart',
        click() {
          // Clear app config
          config.clear()
          // Restart without firing quitting events
          app.relaunch()
          app.exit(0)
        }
      }
    ]
  })
}
github wulkano / kap / main / about.js View on Github external
aboutWindow.show();
    return;
  }

  aboutWindow = new BrowserWindow({
    width: 284,
    height: 200,
    resizable: false,
    maximizable: false,
    minimizable: false,
    fullscreenable: false,
    title: '',
    center: true,
    webPreferences: {
      nodeIntegration: true,
      webSecurity: !is.development // Disable webSecurity in dev to load video over file:// protocol while serving over insecure http, this is not needed in production where we use file:// protocol for html serving.
    },
    show: false
  });

  loadRoute(aboutWindow, 'about');

  ipc.answerRenderer('about-ready', async () => {
    await delay(100);
    aboutWindow.show();
  });

  aboutWindow.on('close', () => {
    aboutWindow = null;
  });
};
github atomiclabs / hyperdex / app / index.js View on Github external
darkTheme: config.get('theme') === 'dark', // GTK+3
		webPreferences: {
			contextIsolation: false,
			nodeIntegration: true,
			enableBlinkFeatures: 'CSSBackdropFilter',

			// TODO: Remove this when using Electron 5 as it will be the default value
			webviewTag: false, // Disabled for security reasons since we don't use it
		},
	});

	win.on('ready-to-show', () => {
		win.show();
	});

	if (is.development) {
		win.loadURL('http://localhost:8080/dev.html');
	} else {
		loadUrl(win);
	}

	disableZoom(win);

	return win;
}
github wulkano / kap / main / index.js View on Github external
const initializePlugins = async () => {
  if (!is.development) {
    try {
      await plugins.prune();
      await plugins.upgrade();
    } catch (error) {
      console.log(error);
    }
  }
};
github nano-wallet-company / nano-wallet-desktop / ember-electron / daemon.js View on Github external
enable: true,
      verbose_logging: is.development,
      server_cert_path: serverCertPath,
      server_key_path: serverKeyPath,
      server_key_passphrase: '',
      server_dh_path: dhparamPath,
      client_certs_path: clientsPath,
    };
  }

  const host = config.rpc.address;
  const port = await getPort({ host, port: [config.rpc.port] });
  const peeringPort = await getPort({ host, port: [config.node.peering_port] });
  config.rpc.port = port;
  config.node.peering_port = peeringPort;
  config.node.logging.log_rpc = is.development;

  const cpuCount = os.cpus().length;
  config.node.io_threads = Math.max(2, Math.ceil(cpuCount / 2));
  config.node.network_threads = config.node.io_threads;
  config.node.work_threads = 2;
  config.node.signature_checker_threads = config.node.io_threads - 1;
  config.node.bootstrap_connections = Math.max(4, config.node.network_threads);
  config.node.bootstrap_connections_max = Math.min(64, config.node.bootstrap_connections * 4);

  const { version: configVersion } = config;
  log.info(`Writing node configuration version ${configVersion}:`, configPath);
  await writeJsonFile(configPath, config, {
    mode: 0o600,
    replacer(key, value) {
      return typeof value === 'object' ? value : String(value);
    },
github wulkano / kap / main / utils / routes.js View on Github external
const loadRoute = (win, routeName) => {
  if (is.development) {
    win.loadURL(`http://localhost:8000/${routeName}`);
    win.openDevTools({mode: 'detach'});
  } else {
    win.loadFile(`${app.getAppPath()}/renderer/out/${routeName}.html`);
    win.openDevTools({mode: 'detach'});
  }
};
github nano-wallet-company / nano-wallet-desktop / ember-electron / main.js View on Github external
const run = async () => {
  log.info(`Starting application: ${productName} ${version} (${environment})`);

  await app.whenReady();

  if (!is.development) {
    autoUpdater.on('error', err => {
      log.error('Error updating:', err);
    });

    autoUpdater.on('checking-for-update', () => {
      log.info('Checking for update:', productName, '>', version);
      global.isUpdating = false;
    });

    autoUpdater.on('update-available', () => {
      log.info('Update available:', productName, '>', version, '(downloading...)');
    });

    autoUpdater.on('update-not-available', () => {
      log.info('Update not available:', productName, '>', version);
    });