This commit is contained in:
crusader 2018-10-02 21:43:26 +09:00
commit 389729aa02

View File

@ -3,7 +3,10 @@ import * as fse from 'fs-extra';
import * as path from 'path';
import * as ChildProcess from 'child_process';
import { shellNeedsPatching, updateEnvironmentForProcess } from '@overflow/core/shell';
import {
shellNeedsPatching,
updateEnvironmentForProcess
} from '@overflow/core/shell';
import { parseAppURL } from '@overflow/core/parse-app-url';
// import {
// enableSourceMaps,
@ -33,9 +36,8 @@ const launchTime = now();
let preventQuit = false;
let readyTime: number | null = null;
let db: sqlite3.Database;
let probeProcess: ChildProcess.ChildProcess;
let db: sqlite3.Database | null = null;
let probeProcess: ChildProcess.ChildProcess | null = null;
type OnDidLoadFn = (window: AppWindow) => void;
/** See the `onDidLoad` function. */
@ -167,7 +169,7 @@ function setAsDefaultProtocolClient(protocol: string) {
if (__WIN32__) {
app.setAsDefaultProtocolClient(protocol, process.execPath, [
'--protocol-launcher',
'--',
'--'
]);
} else {
app.setAsDefaultProtocolClient(protocol);
@ -190,8 +192,6 @@ app.on('ready', () => {
? path.join(__dirname, '..', '..', 'config', '_database.sqlite')
: path.join(__dirname, '..', '..', 'bin', 'database.sqlite');
db = new sqlite3.Database(dbPath, sqlite3.OPEN_READONLY, (err: Error) => {
if (err) {
console.error(err.message);
@ -228,9 +228,7 @@ app.on('ready', () => {
ipcMain.on(
'update-preferred-app-menu-item-labels',
(
event: Electron.IpcMessageEvent,
) => {
(event: Electron.IpcMessageEvent) => {
menu = buildDefaultMenu();
Menu.setApplicationMenu(menu);
if (mainWindow) {
@ -421,7 +419,6 @@ app.on('before-quit', function (event) {
if (null !== probeProcess && !probeProcess.killed) {
probeProcess.kill();
}
});
// app.on(
@ -440,14 +437,14 @@ function createWindow() {
if (__DEV__) {
const {
default: installExtension,
default: installExtension
} = require('electron-devtools-installer');
require('electron-debug')({ showDevTools: true });
const ChromeLens = {
id: 'idikgljglpfilbhaboonnpnnincjhjkd',
electron: '>=1.2.1',
electron: '>=1.2.1'
};
const extensions = [ChromeLens];
@ -473,7 +470,7 @@ function createWindow() {
window.sendLaunchTimingStats({
mainReadyTime: readyTime ? readyTime : 0,
loadTime: window.loadTime ? window.loadTime : 0,
rendererReadyTime: window.rendererReadyTime ? window.rendererReadyTime : 0,
rendererReadyTime: window.rendererReadyTime ? window.rendererReadyTime : 0
});
const fns = onDidLoadFns ? onDidLoadFns : null;