Electron Architecture
Desktop App is a Electron wrapper around packages/frontend/core
under packages/frontend/electron
.
Purpose of Desktop App is to provide some new abilities in the future such as
-
Portable DB files
-
Multiple window support
-
Extensions
-
…
Communication between web (renderer) and main
Native capabilities in main/helper process are exposed to renderer window as individual APIs in the runtime. There are two types of the APIs, i.e., handlers & events, where handlers is to let the web to call functions in the native side, and events let the web to register native event listeners.
You can list all of them by inspecting apis
object in dev tools console:
These APIs are typed and inferred from where they are declared/implemented:
Multi-Process Model
In the native side, we introduced another helper process using Electron’s new UtilityProcess API to offload the blocking job (workspace, DB, dialog). We use async-call-rpc to handle bi-directional IPC calls.
References
Some diagrams (maybe outdated)