tinycodinglm / lang /lang-0008.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 15)
b27bfb3 verified
|
Raw History Blame Contribute Delete
1.25 kB
opencode trace
System You are an expert software engineer.

You are an expert software engineer.

User

Explain Electron's architecture

Assistant

Electron combines Chromium and Node.js for desktop apps.

Process model:

  • Main process: Node.js + Chromium, runs once per app, manages windows
  • Renderer process: Chromium, one per window/BrowserWindow, runs web content
  • Preload scripts: bridge between main and renderer, isolated context

IPC communication:

  • ipcMain/ipcRenderer for synchronous and asynchronous messaging
  • contextBridge for secure context exposure
  • MessagePort/MessageChannel for channel-based communication

BrowserWindow lifecycle:

  • creation -> ready-to-show -> show -> close -> closed
  • webContents manages the renderer process
  • session for network, storage, cookies

Security:

  • contextIsolation: true (default), nodeIntegration: false
  • session.setPermissionRequestHandler for permission control
  • Content Security Policy (CSP) headers
  • sandbox: true for renderer process isolation