ing
This commit is contained in:
parent
e12cf15dda
commit
df1c926c67
|
@ -33,6 +33,10 @@ const launchTime = now();
|
||||||
let preventQuit = false;
|
let preventQuit = false;
|
||||||
let readyTime: number | null = null;
|
let readyTime: number | null = null;
|
||||||
|
|
||||||
|
let db: sqlite3.Database;
|
||||||
|
let probeProcess: ChildProcess.ChildProcess;
|
||||||
|
|
||||||
|
|
||||||
type OnDidLoadFn = (window: AppWindow) => void;
|
type OnDidLoadFn = (window: AppWindow) => void;
|
||||||
/** See the `onDidLoad` function. */
|
/** See the `onDidLoad` function. */
|
||||||
let onDidLoadFns: Array<OnDidLoadFn> | null = [];
|
let onDidLoadFns: Array<OnDidLoadFn> | null = [];
|
||||||
|
@ -186,7 +190,9 @@ app.on('ready', () => {
|
||||||
path.join(__dirname, '..', '..', 'config', '_database.sqlite')
|
path.join(__dirname, '..', '..', 'config', '_database.sqlite')
|
||||||
: path.join(__dirname, '..', '..', 'bin', 'database.sqlite');
|
: path.join(__dirname, '..', '..', 'bin', 'database.sqlite');
|
||||||
|
|
||||||
const db = new sqlite3.Database(dbPath, sqlite3.OPEN_READONLY, (err: Error) => {
|
|
||||||
|
|
||||||
|
db = new sqlite3.Database(dbPath, sqlite3.OPEN_READONLY, (err: Error) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err.message);
|
console.error(err.message);
|
||||||
}
|
}
|
||||||
|
@ -195,7 +201,7 @@ app.on('ready', () => {
|
||||||
|
|
||||||
if (!__DEV__) {
|
if (!__DEV__) {
|
||||||
const probePath = path.join(__dirname, '..', '..', 'bin', 'probe');
|
const probePath = path.join(__dirname, '..', '..', 'bin', 'probe');
|
||||||
ChildProcess.spawn(probePath);
|
probeProcess = ChildProcess.spawn(probePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
readyTime = now() - launchTime;
|
readyTime = now() - launchTime;
|
||||||
|
@ -403,6 +409,19 @@ app.on('web-contents-created', (event, contents) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.on('before-quit', function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
if (null !== db) {
|
||||||
|
db.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null !== probeProcess && !probeProcess.killed) {
|
||||||
|
probeProcess.kill();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
// app.on(
|
// app.on(
|
||||||
// 'certificate-error',
|
// 'certificate-error',
|
||||||
// (event, webContents, url, error, certificate, callback) => {
|
// (event, webContents, url, error, certificate, callback) => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user