I followed the documentation's code and tried to adapt it to my use case, but I am unable to receive anything on SvelteKit (the framework I use for my frontend)
I was able to confirm that the event HAS been triggered in my preload.ts with a console.log,
Here is my preload.ts
import { contextBridge, ipcRenderer } from "electron";
contextBridge.exposeInMainWorld("electronAPI", {
onSimStatusUpdate: (callback: any) =>
ipcRenderer.on("sim-status-update", (value) => callback(value)),
});
and here is my code in my Frontend:
window.electronAPI.onSimStatusUpdate((newStatus: number) => {
console.log(newStatus)
connectionStatus.set(newStatus)
});
I have also confirmed that that line gets executed with a console log, but I never get any log from the newStatus
Im quite lost, and inexperienced with both Electron and IPCs, s I was wondering if anyone could provide me a bit of insight, I probably messed up some syntax somewhere, so feel free to correct me 😄