ghost-portal/packages/apps-electron/src/electron/index.ts
Ewa Kowalska 87505b1c59
Eslint imports (#4037)
* Add eslint configuration

* Patch eslint plugin for sorting imports

* Apply eslint rules for imports
2020-12-01 14:40:42 +01:00

30 lines
838 B
TypeScript

// Copyright 2017-2020 @polkadot/apps authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { app, shell } from 'electron';
import { registerAccountStoreHandlers } from '../main/account-store';
import { setupAutoUpdater } from './autoUpdater';
import { setupContentSecurityPolicy } from './contentSecurityPolicy';
import { createWindow } from './window';
const ENV = process.env.NODE_ENV || 'production';
app.on('web-contents-created', (_, webContents): void => {
webContents.on('new-window', (e, url): void => {
e.preventDefault();
shell.openExternal(url).catch(console.error);
});
});
app
.whenReady()
.then(async (): Promise<void> => {
registerAccountStoreHandlers();
setupContentSecurityPolicy(ENV);
await createWindow(ENV);
await setupAutoUpdater();
})
.catch(console.error);