Events let the main process send messages to the renderer process. They’re useful for things like push notifications, streaming output, or reacting to something that happened on the server side. Unlike RPC (where the renderer calls the main process and waits for a response), events are one-way: the main process fires them and any listener in the renderer process receives them.Documentation Index
Fetch the complete documentation index at: https://zenbulabs.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Defining events
You define events in a TypeScript file as a type with a name and payload for each event. This file needs to be registered in your config viadefinePlugin({ events: "./src/main/events.ts" }) so the framework can keep everything type-safe.
src/main/events.ts
Emitting events
From a service, emit events throughthis.ctx.rpc.emit:
Listening to events
From React, use theuseEvents hook to subscribe:
Events vs RPC vs database
- Events are for transient updates that don’t need to be persisted, like streaming terminal output or push notifications.
- RPC is for getting the main process to run code the renderer process can’t, like reading a file or calling a system API.
- Database is for state that should persist and drive your UI.

