-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathindex.js
31 lines (25 loc) · 779 Bytes
/
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
const { app, BrowserWindow, ipcMain } = require("electron")
const path = require('path');
const url = require('url');
var knex = require("knex")({
client: "sqlite3",
connection: {
filename: path.join(__dirname, 'database.sqlite')
}
});
app.on("ready", () => {
let mainWindow = new BrowserWindow({ height: 800, width: 800, show: false })
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'main.html'),
protocol: 'file',
slashes: true
}));
mainWindow.once("ready-to-show", () => { mainWindow.show() })
ipcMain.on("mainWindowLoaded", function () {
let result = knex.select("FirstName").from("User")
result.then(function(rows){
mainWindow.webContents.send("resultSent", rows);
})
});
});
app.on("window-all-closed", () => { app.quit() })