-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
64 lines (64 loc) · 1.78 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"use strict";
exports.__esModule = true;
var electron_1 = require("electron");
var Knex = require("knex");
var win;
var knex = Knex({
client: "sqlite3",
connection: {
filename: "./database.sqlite"
}
});
function createWindow() {
win = new electron_1.BrowserWindow({
width: 1280,
height: 800,
icon: 'src/assets/minBlogger-grey.ico',
// frame: false,
webPreferences: {
nodeIntegration: true,
allowRunningInsecureContent: false
}
});
// require('electron-reload')(__dirname, {
// electron: require(`${__dirname}/node_modules/electron`)
// });
win.loadURL("http://localhost:4200");
win.on('closed', function () {
win = null;
});
// ipcMain.on("mainWindowLoaded", function () {
// let result = knex.select("FirstName").from("User");
// result.then(function (rows) {
// console.log(rows);
// win.webContents.send("resultSent", rows);
// });
// });
knex.select("*").from("User").then(function (rows) {
console.log("Testing sqlite in electron with * Users => ", rows);
});
// win.webContents.on('did-finish-load', () => {
// ipcMain.on('ping', (event, arg) => {
// console.log(arg); // prints "ping by Welcome"
// event.returnValue = 'pong by Electron';
// });
// });
return win;
}
try {
electron_1.app.allowRendererProcessReuse = true;
electron_1.app.on('ready', createWindow);
electron_1.app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
electron_1.app.quit();
}
});
electron_1.app.on('activate', function () {
if (win == null) {
createWindow();
}
});
}
catch (error) {
throw error;
}