This repository was archived by the owner on Jan 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.js
More file actions
56 lines (48 loc) · 1.28 KB
/
main.js
File metadata and controls
56 lines (48 loc) · 1.28 KB
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
const {
app,
BrowserWindow,
Notification,
ipcMain,
TouchBar
} = require("electron");
const { TouchBarButton } = TouchBar;
function createWindow() {
// Create the browser window.
win = new BrowserWindow({ width: 1600, height: 800 });
win.toggleDevTools();
// and load the index.html of the alfresco content app (aca).
win.loadURL("http://localhost:4200");
initUpload();
initUploadProgress();
initTouchbar();
}
initTouchbar = () => {
let touchbarButton = new TouchBarButton({
icon: "./assets/alfresco.png",
click: () => {
console.log("Click");
win.webContents.send("takeImage");
}
});
let touchbar = new TouchBar({ items: [touchbarButton] });
win.setTouchBar(touchbar);
};
initUpload = () => {
ipcMain.on("upload", (event, args) => {
console.log("Upload completed");
let uploadNotification = new Notification({
title: "Upload complete!",
subtitle: 'File "' + args[0].name + "' has been uploaded successfully."
});
console.log("Args", args);
uploadNotification.show();
win.setProgressBar(-1);
});
};
initUploadProgress = () => {
ipcMain.on("uploadProgress", (event, args) => {
console.log("Upload progress");
win.setProgressBar(args[0].progress / 100);
});
};
app.on("ready", createWindow);