Die Architektur von Electron verstehen
Entwickeln Sie ein klares mentales Modell dafür, wie Electron Chromium und Node.js kombiniert und wie Main- und Renderer-Prozesse zusammenarbeiten, bevor Sie größere Apps entwickeln.
Die Architektur von Electron verstehen ist eine kostenlose Electron Desktop App Development-Lektion auf CoddyKit. Dies ist Lektion 4 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Electron Desktop App Development-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Electron Desktop App Development-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
Two Worlds in One App
Electron fuses two runtimes: Chromium for the UI and Node.js for system access. Grasping how they coexist is the foundation of every app.
The Main Process
Each app has exactly one main process. It runs your entry file, controls the lifecycle, and creates BrowserWindow instances with full Node access.
const { app, BrowserWindow } = require('electron');
app.whenReady().then(() => {
new BrowserWindow({ width: 800, height: 600 });
});The Renderer Process
Each window runs its own renderer process — basically a Chromium tab rendering HTML, CSS, and JavaScript like any web page.
Why Separate Processes?
Separate processes buy you stability and security: one window crashing won't kill the app, and the UI can't freely poke the OS.
Chromium's Role
Chromium is the same engine as Chrome. It handles rendering, layout, and the DOM, keeping your app consistent across platforms.
Node.js's Role
Node.js brings the file system, networking, and npm packages into your app — the part that makes Electron more than just a browser.
const os = require('os');
console.log('Platform:', os.platform());
console.log('CPUs:', os.cpus().length);The Event Loop
The main process shares Node's event loop. Long synchronous work freezes the UI, so reach for async patterns instead.
setTimeout(() => console.log('runs later'), 0);
console.log('runs first');Process Communication Preview
Main and renderer are in separate memory spaces; they talk through IPC (inter-process communication). You will dive into it later.
The package.json Entry
Electron finds the main process file via the main field in package.json. The snippet below shows the minimal entry config.
{
"name": "my-app",
"main": "main.js",
"scripts": { "start": "electron ." }
}Cross-Platform Promise
Write once, run on Windows, macOS, and Linux. Electron bundles the runtime, so users never need a browser installed.
Putting It Together
It all loops together: the main process boots, makes a window, the renderer loads your page, and IPC links them — the heartbeat of every app.
Quick Check
Confirm your understanding of Electron processes.
Recap
You've got the architecture: one main process (Node.js) driving multiple renderer processes (Chromium), connected by IPC for safe desktop apps.
Häufig gestellte Fragen
Ist die Lektion „Die Architektur von Electron verstehen“ kostenlos?
Ja — der vollständige Text von „Die Architektur von Electron verstehen“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Electron Desktop App Development-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Electron Desktop App Development-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Die Architektur von Electron verstehen“?
Entwickeln Sie ein klares mentales Modell dafür, wie Electron Chromium und Node.js kombiniert und wie Main- und Renderer-Prozesse zusammenarbeiten, bevor Sie größere Apps entwickeln. Du übst Electron Desktop App Development mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um Electron Desktop App Development zu starten?
Keine Vorkenntnisse erforderlich. Electron Desktop App Development auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 4 von 4.
Wie lange dauert die Lektion „Die Architektur von Electron verstehen“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser Electron Desktop App Development-Lektion Code schreiben und ausführen?
Ja. Jede Electron Desktop App Development-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Was ist Electron?
- Entwicklungsumgebung einrichten
- Ihre erste Electron-Anwendung
- Die Architektur von Electron verstehen