Skip to content

Commit

Permalink
wip: Handle type:module building
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertGemmaJr committed Aug 5, 2024
1 parent 5f54457 commit 1956606
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import { getPort, sendToPort } from "./lib/serialport";
// TODO @brown-ccv #192: Handle data writing to desktop in a utility process
// TODO @brown-ccv #192: Handle video data writing to desktop in a utility process

console.log("MAIN", import.meta.dirname, import.meta.filename);

/************ GLOBALS ***********/

const IS_DEV = import.meta.env.DEV && !app.isPackaged;
Expand Down Expand Up @@ -303,7 +301,14 @@ function createWindow() {
const mainWindow = new BrowserWindow({
icon: "./favicon.ico",
// webPreferences: { preload: path.join(__dirname, "preload.js") },
webPreferences: { preload: path.join(import.meta.dirname, "preload.js") },
webPreferences: {
// preload: path.join(import.meta.dirname, "preload.js"),
preload: path.join(import.meta.dirname, "preload.mjs"),
// TEST
sandbox: false,
contextIsolation: true,
// enableRemoteModule: false,
},
width: 1500,
height: 900,
// TODO @brown-ccv: Settings for preventing the menu bar from ever showing up
Expand Down
5 changes: 5 additions & 0 deletions src/Electron/preload.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { contextBridge, ipcRenderer } from "electron";
import log from "electron-log";

log.info("PRELOAD");
/** Load bridges between the main and renderer processes when the preload process is first loaded */
process.once("loaded", () => {
// TODO: The "loaded" state is never executed for some reason
console.log("PRELOAD LOADED");
log.info("PRELOAD LOADED");
contextBridge.exposeInMainWorld("electronAPI", {
setConfig: (config) => ipcRenderer.send("setConfig", config),
setTrigger: (triggerCodes) => ipcRenderer.send("setTrigger", triggerCodes),
Expand Down
2 changes: 2 additions & 0 deletions src/config/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ const config = {
USE_EEG,
USE_CAMERA,
};

console.log("CONFIG", window.electronAPI, config);
export default config;

0 comments on commit 1956606

Please sign in to comment.