Newer
Older
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
import { killParity } from '@parity/electron';
import electron from 'electron';
import FetherApp from './app';
import FetherAppOptions from './app/options';
const { app } = electron;
// Disable gpu acceleration on linux
// https://github.com/parity-js/fether/issues/85
if (!['darwin', 'win32'].includes(process.platform)) {
app.disableHardwareAcceleration();
}
const fetherAppInstance = new FetherApp();
const fetherAppOptionsInstance = new FetherAppOptions();
const options = fetherAppOptionsInstance.create();
fetherAppInstance.create(options);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
// Make sure Parity Ethereum stops when UI stops
app.on('before-quit', killParity);
app.on('will-quit', killParity);
app.on('quit', killParity);
// FIXME - determine how to trigger this to check that it works and doesn't create duplicate!
// perhaps it should be `!hasVisibleWindows && !fetherAppInstance` instead
// See https://electronjs.org/docs/api/app#event-activate-macos
app.on('activate', (event, hasVisibleWindows) => {
if (!hasVisibleWindows || fetherAppInstance.fetherApp.window === null) {
fetherAppInstance.create(options);