-
Notifications
You must be signed in to change notification settings - Fork 13
/
n4m-handpose_main.js
84 lines (68 loc) · 2.24 KB
/
n4m-handpose_main.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
const { app, BrowserWindow } = require("electron");
const Store = require('electron-store');
Store.initRenderer();
function createWindow() {
console.log("Loading n4m-handpose..");
// Create the browser window.
const win = new BrowserWindow({
width: 622,
height: 542,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
});
// uncomment for debug console:
// win.webContents.openDevTools();
// and load the html of the app.
win.loadFile("./n4m-handpose_camera.html");
}
app.on("ready", createWindow);
//---------todo:
// const { app, BrowserWindow, ipcMain } = require("electron");
// const path = require("path");
// const fs = require("fs");
// const SocketIOClient = require("socket.io-client");
// const io = new SocketIOClient("http://localhost:3000");
// const socket = io.connect();
// socket.on("connect", () => {
// console.log("Connected to Max 8");
// //socket.emit("dispatch", "Socket is connected, Ready");
// });
// const handpose = require("@tensorflow-models/handpose");
// const dat = require("dat.gui");
// const Stats = require("stats.js");
// // Keep a global reference of the window object, if you don't, the window will
// // be closed automatically when the JavaScript object is garbage collected.
// let win;
// async function createWindow()
// {
// // Create the browser window.
// win = new BrowserWindow({
// width: 800,
// height: 600,
// webPreferences: {
// nodeIntegration: false, // is default value after Electron v5
// contextIsolation: true, // protect against prototype pollution
// enableRemoteModule: false, // turn off remote
// preload: path.join(__dirname, "n4m-handpose_preload.js") // use a preload script
// }
// });
// // uncomment for debug console:
// win.webContents.openDevTools();
// // load the html of the electron app.
// win.loadFile("./n4m-handpose_camera.html");
// }
// app.on("ready", createWindow);
// ipcMain.on("toMain", (event, args) => {
// fs.readFile("path/to/file", (error, data) => {
// // Do something with file contents
// // Send result back to renderer process
// win.webContents.send("fromMain", responseObj);
// });
// });
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
});