Electron

: contextBridge.exposeInMainWorld('myAPI', { doSomething: () => ipcRenderer.send('trigger-feature') }) . 3. Build the User Interface (Renderer Process)

Perform the "heavy lifting" or native API calls (e.g., using the dialog module to open files). Send results back to the renderer if necessary. 2. Securely Expose the Feature (Preload Script) Electron

: Create custom system tray icons or native context menus. : contextBridge

Listen for custom events using ipcMain.on or ipcMain.handle . Electron

Call the exposed functions from your window object (e.g., window.myAPI.doSomething() ).

Expose specific functions to the window object that trigger IPC (Inter-Process Communication) events.

Because of , the renderer cannot access Node.js or Electron APIs directly. Use the contextBridge API to create a "safe" bridge.