This commit is contained in:
crusader 2018-10-02 21:48:02 +09:00
parent df1c926c67
commit 2c594295a6
2 changed files with 16 additions and 1309 deletions

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);
@ -186,12 +188,10 @@ app.on('ready', () => {
return;
}
const dbPath = __DEV__ ?
path.join(__dirname, '..', '..', 'config', '_database.sqlite')
const dbPath = __DEV__
? 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) {
@ -256,7 +254,7 @@ app.on('ready', () => {
const menuItem = findMenuItemByID(menu, id);
if (menuItem) {
const window = BrowserWindow.fromWebContents(event.sender);
const fakeEvent = { preventDefault: () => { }, sender: event.sender };
const fakeEvent = { preventDefault: () => {}, sender: event.sender };
menuItem.click(fakeEvent, window, event.sender);
}
}
@ -409,7 +407,7 @@ app.on('web-contents-created', (event, contents) => {
});
});
app.on('before-quit', function (event) {
app.on('before-quit', function(event) {
event.preventDefault();
if (null !== db) {
@ -419,7 +417,6 @@ app.on('before-quit', function (event) {
if (null !== probeProcess && !probeProcess.killed) {
probeProcess.kill();
}
});
// app.on(
@ -438,14 +435,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];
@ -453,7 +450,7 @@ function createWindow() {
for (const extension of extensions) {
try {
installExtension(extension);
} catch (e) { }
} catch (e) {}
}
}
@ -469,7 +466,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;

1290
yarn.lock

File diff suppressed because it is too large Load Diff