Updated the Obsidian docs-vault

This commit is contained in:
Mohammed Abad committed 2026-04-22 14:48:43 +01:00
1 parent 72fd77ee01
commit 260282a0e2
36 files changed
+3497 -144

No files matched your search

+68 -4
View File
@@ -1,11 +1,75 @@
---
title: Electron
tags:
- electron
- desktop
---
# Electron
## Overview
Desktop wrapper using Electron. Entry point: `electron/main.js`.
Electron 34 wraps the Showy backend + frontend into a standalone desktop application for Windows.
## Architecture
```mermaid
graph TD
E[Electron Main Process] --> |child_process.spawn| B[Node.js Backend]
E --> |BrowserWindow.loadFile| FE[Frontend Build]
FE --> |HTTP requests| B
E --> |IPC: backend-ready| FE
```
## Main Process — `electron/main.js`
1. Spawns backend as a **child process**: `node backend/server.js`
2. Sets `PARENT_PROCESS` env var pointing to Electron user data path
3. Backend auto-restarts if it crashes
4. Creates `BrowserWindow` (1200×720) loading `frontend_build/browser/index.html`
5. Sends `backend-ready` IPC event when backend starts listening
6. On window close → kills backend child process
### Window Configuration
| Setting | Value |
|---|---|
| Width | 1200 |
| Height | 720 |
| Context Isolation | `true` |
| Sandbox | `true` |
| Node Integration | `true` |
## Preload Script — `electron/preload.js`
Exposes `electron.ipcRenderer` to the renderer process via `contextBridge.exposeInMainWorld`:
- `send(channel, data)` — send to main
- `on(channel, callback)` — listen from main
## Build Configuration
| Field | Value |
|---|---|
| `appId` | `x4lo.showy` |
| Target | Windows x64 directory output |
| Icon | From Angular frontend assets |
## Package Dependencies
- `electron` 34
- `electron-builder` 25
- All backend dependencies (bundled)
## Important Files
- `electron/main.js` — Main process
- `electron/preload.js` — Preload script
- `electron/package.json` — Electron dependencies
| File | Role |
|---|---|
| `electron/main.js` | Main process entry |
| `electron/preload.js` | Context bridge for IPC |
| `electron/package.json` | Electron + backend deps |
## See Also
- [[Architecture]] — System overview
- [[Deployment]] — Docker alternative