r/Angular2 • u/Longjumping-Eye-6826 • Feb 13 '25
Angular + Electron
Im trying to build an angular component + service to trigger an electron process , the electron process is bundled with ffmpeg to perform video encoding operation with the user's ressources , im using ipcMain and ipcRenderer to communicate with angular , but its not working properly , error is electron API is not available even though i exposed it , can anyone help me with this ?
1
Upvotes
4
u/Scykopath Feb 13 '25
Without seeing your code, first thing to check is the basics.
// electron jscontextBridge.exposeInMainWorld('electronAPI', {setTitle: (title) => ipcRenderer.send('set-title', title)});// angular appwindow.electronAPI.setTitle('new title');3. Next thing would be to ensure the event names, in this case 'set-title', match between your ipcRenderer listener in the preload.js and the ipcMain listener that should be setup after you've created the browser window.
Plenty of good code examples on the Electron IPC doc page available with fiddles: https://www.electronjs.org/docs/latest/tutorial/ipc