electron-api

Installation
SKILL.md

Adding Electron APIs

Electron APIs allow the frontend to call Electron main process functionality directly via IPC.

Four Files to Edit

  1. frontend/types/custom.d.ts - TypeScript ElectronApi type
  2. emain/preload.ts - Expose method via contextBridge
  3. emain/emain-ipc.ts - Implement IPC handler
  4. frontend/preview/preview-electron-api.ts - Add a no-op stub to keep the previewElectronApi object in sync with the ElectronApi type

Three Communication Patterns

  1. Sync - ipcRenderer.sendSync() + ipcMain.on() + event.returnValue = ...
  2. Async - ipcRenderer.invoke() + ipcMain.handle()
  3. Fire-and-forget - ipcRenderer.send() + ipcMain.on()

Example: Async Method

Installs
27
GitHub Stars
21.0K
First Seen
Feb 27, 2026
electron-api — wavetermdev/waveterm