-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
74 lines (68 loc) · 2.34 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
65
66
67
68
69
70
71
72
73
74
/** /
// Pure puppeteer version
const puppeteer = require("puppeteer");
const run_browser = async () => {
const browser = await puppeteer.launch({
headless: false,
defaultViewport: null,
args: ["--no-sandbox", "--disable-setuid-sandbox"]
});
const page = await browser.newPage();
await page.goto("https://example.com");
};
const read_events = file => {
console.log("click");
run_browser();
// console.log(file);
};
(async () => {
const controls_browser = await puppeteer.launch({
headless: false,
defaultViewport: null,
frame: false,
args: ["--app=http://localhost:3000", "--start-maximized"] //, "--kiosk"]
// args: ["--app=http://localhost:3000", "--window-size=800,250", "--window-position=560,900"]
});
const _controls = await controls_browser.pages();
const controls = _controls[0];
controls.once("load", async () => {
console.log("Page loaded!");
const win = await controls.evaluateHandle("window");
win.read_events = read_events;
});
controls.exposeFunction("read_events", arg => {
console.log(arg);
});
// await controls.evaluateHandle(function() {
// window.read_events = read_events;
// });
})();
/*/
// Electron version
const { app, BrowserWindow } = require("electron");
const path = require("path");
let mainWindow;
app.on("ready", () => {
mainWindow = new BrowserWindow({
// width: 800,
// height: 250,
// x: 560,
// y: 900,
// maximizable: false,
alwaysOnTop: true,
autoHideMenuBar: true,
title: "UXEEG is getting ready",
// frame: false,
webPreferences: {
nodeIntegration: true
}
});
mainWindow.maximize();
mainWindow.webContents.openDevTools();
mainWindow.loadURL("http://localhost:3000");
mainWindow.on("closed", function() {
mainWindow = null;
app.quit();
});
});
/**/