electron-egg
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWhen to use this skill
何时使用本技能
Use this skill whenever the user wants to:
- Install and set up Electron EGG in a project
- Create Electron desktop applications
- Use Electron EGG core features
- Configure Electron EGG
- Handle main process and renderer process communication
- Use Electron EGG API methods
- Build and package Electron applications
- Troubleshoot Electron EGG issues
当用户有以下需求时,可使用本技能:
- 在项目中安装和配置Electron EGG
- 创建Electron桌面应用
- 使用Electron EGG核心功能
- 配置Electron EGG
- 处理主进程与渲染进程的通信
- 使用Electron EGG API方法
- 构建和打包Electron应用
- 排查Electron EGG相关问题
How to use this skill
如何使用本技能
This skill is organized to match the Electron EGG official documentation structure (https://www.kaka996.com/, https://www.kaka996.com/pages/987b1c/, https://www.kaka996.com/pages/a99b72/). When working with Electron EGG:
-
Identify the topic from the user's request:
- Installation/安装 →
examples/guide/installation.md - Quick Start/快速开始 →
examples/guide/quick-start.md - Features/功能特性 →
examples/features/ - API/API 文档 →
api/
- Installation/安装 →
-
Load the appropriate example file from thedirectory:
examples/Guide (使用文档):- - Introduction to Electron EGG
examples/guide/intro.md - - Installation guide
examples/guide/installation.md - - Quick start guide
examples/guide/quick-start.md - - Project structure
examples/guide/project-structure.md - - Configuration
examples/guide/configuration.md - - Build and package
examples/guide/build.md
Features (功能特性):- - Main process
examples/features/main-process.md - - Renderer process
examples/features/renderer-process.md - - IPC communication
examples/features/ipc-communication.md - - Window management
examples/features/window-management.md - - Menu
examples/features/menu.md - - System tray
examples/features/tray.md - - Auto updater
examples/features/auto-updater.md - - Plugin system
examples/features/plugin-system.md
-
Follow the specific instructions in that example file for syntax, structure, and best practicesImportant Notes:
- Electron EGG is based on Electron and Egg.js
- Main process and renderer process separation
- IPC communication between processes
- Each example file includes key concepts, code examples, and key points
-
Reference API documentation in thedirectory when needed:
api/- - Main process API
api/main-api.md - - Renderer process API
api/renderer-api.md - - IPC API
api/ipc-api.md - - Window API
api/window-api.md - - Configuration API
api/config-api.md
API Files:- - Application class, BrowserWindow, ipcMain, app methods
api/main-api.md - - ipcRenderer, contextBridge, DOM APIs
api/renderer-api.md - - IPC communication methods and events
api/ipc-api.md - - Window creation and management
api/window-api.md - - Configuration options and environment variables
api/config-api.md
-
Use templates from thedirectory:
templates/- - Installation templates
templates/installation.md - - Project setup templates
templates/project-setup.md - - Configuration templates
templates/configuration.md
本技能的结构与Electron EGG官方文档(https://www.kaka996.com/, https://www.kaka996.com/pages/987b1c/, https://www.kaka996.com/pages/a99b72/)保持一致。使用Electron EGG时:
-
识别用户请求的主题:
- 安装 →
examples/guide/installation.md - 快速开始 →
examples/guide/quick-start.md - 功能特性 →
examples/features/ - API文档 →
api/
- 安装 →
-
从目录加载对应的示例文件:
examples/使用文档:- - Electron EGG介绍
examples/guide/intro.md - - 安装指南
examples/guide/installation.md - - 快速开始指南
examples/guide/quick-start.md - - 项目结构
examples/guide/project-structure.md - - 配置说明
examples/guide/configuration.md - - 构建与打包
examples/guide/build.md
功能特性:- - 主进程
examples/features/main-process.md - - 渲染进程
examples/features/renderer-process.md - - IPC通信
examples/features/ipc-communication.md - - 窗口管理
examples/features/window-management.md - - 菜单
examples/features/menu.md - - 系统托盘
examples/features/tray.md - - 自动更新
examples/features/auto-updater.md - - 插件系统
examples/features/plugin-system.md
-
遵循示例文件中的语法、结构与最佳实践重要说明:
- Electron EGG基于Electron和Egg.js构建
- 主进程与渲染进程相互分离
- 进程间通过IPC通信
- 每个示例文件包含核心概念、代码示例与关键点
-
必要时参考目录下的API文档:
api/- - 主进程API
api/main-api.md - - 渲染进程API
api/renderer-api.md - - IPC API
api/ipc-api.md - - 窗口API
api/window-api.md - - 配置API
api/config-api.md
API文件详情:- - Application类、BrowserWindow、ipcMain、app方法
api/main-api.md - - ipcRenderer、contextBridge、DOM APIs
api/renderer-api.md - - IPC通信方法与事件
api/ipc-api.md - - 窗口创建与管理
api/window-api.md - - 配置选项与环境变量
api/config-api.md
-
使用目录下的模板:
templates/- - 安装模板
templates/installation.md - - 项目搭建模板
templates/project-setup.md - - 配置模板
templates/configuration.md
1. Understanding Electron EGG
1. 理解Electron EGG
Electron EGG is a desktop application development framework based on Electron and Egg.js, providing a complete development toolchain and best practices.
Key Concepts:
- Electron: Cross-platform desktop application framework
- Egg.js: Node.js enterprise application framework
- Main Process: Main application process
- Renderer Process: UI rendering process
- IPC: Inter-process communication
- Plugin System: Extensible plugin architecture
Electron EGG是基于Electron和Egg.js的桌面应用开发框架,提供完整的开发工具链与最佳实践。
核心概念:
- Electron: 跨平台桌面应用框架
- Egg.js: Node.js企业级应用框架
- 主进程: 应用主进程
- 渲染进程: UI渲染进程
- IPC: 进程间通信
- 插件系统: 可扩展的插件架构
2. Installation
2. 安装
Using npm:
bash
npm install electron-eggUsing yarn:
bash
yarn add electron-eggUsing pnpm:
bash
pnpm add electron-egg使用npm安装:
bash
npm install electron-egg使用yarn安装:
bash
yarn add electron-egg使用pnpm安装:
bash
pnpm add electron-egg3. Basic Setup
3. 基础配置
javascript
// main.js
const { Application } = require('electron-egg')
const app = new Application({
// Configuration
})
app.start()javascript
// main.js
const { Application } = require('electron-egg')
const app = new Application({
// 配置项
})
app.start()Doc mapping (one-to-one with official documentation)
文档映射(与官方文档一一对应)
- → https://www.kaka996.com/pages/987b1c/
examples/ - → https://www.kaka996.com/pages/a99b72/
api/
- → https://www.kaka996.com/pages/987b1c/
examples/ - → https://www.kaka996.com/pages/a99b72/
api/
Examples and Templates
示例与模板
This skill includes detailed examples organized to match the official documentation structure. All examples are in the directory (see mapping above).
examples/To use examples:
- Identify the topic from the user's request
- Load the appropriate example file from the mapping above
- Follow the instructions, syntax, and best practices in that file
- Adapt the code examples to your specific use case
To use templates:
- Reference templates in directory for common scaffolding
templates/ - Adapt templates to your specific needs and coding style
本技能包含与官方文档结构一致的详细示例,所有示例均位于目录(见上述映射关系)。
examples/使用示例:
- 从用户请求中识别主题
- 根据上述映射加载对应的示例文件
- 遵循文件中的说明、语法与最佳实践
- 根据具体需求调整代码示例
使用模板:
- 参考目录下的模板进行常见脚手架搭建
templates/ - 根据具体需求与编码风格调整模板
API Reference
API参考
Detailed API documentation is available in the directory, organized to match the official Electron EGG API documentation structure (https://www.kaka996.com/pages/a99b72/):
api/详细的API文档位于目录,与Electron EGG官方API文档(https://www.kaka996.com/pages/a99b72/)结构一致:
api/Main Process API (api/main-api.md
)
api/main-api.md主进程API (api/main-api.md
)
api/main-api.md- Application class and methods
- BrowserWindow creation and management
- ipcMain IPC handling
- Application lifecycle hooks
- Application类与方法
- BrowserWindow创建与管理
- ipcMain IPC处理
- 应用生命周期钩子
Renderer Process API (api/renderer-api.md
)
api/renderer-api.md渲染进程API (api/renderer-api.md
)
api/renderer-api.md- ipcRenderer IPC communication
- contextBridge for secure API exposure
- DOM APIs available in renderer
- Event handling
- ipcRenderer IPC通信
- contextBridge安全API暴露
- 渲染进程可用的DOM APIs
- 事件处理
IPC API (api/ipc-api.md
)
api/ipc-api.mdIPC API (api/ipc-api.md
)
api/ipc-api.md- IPC communication methods (ipcMain, ipcRenderer)
- Message sending and receiving
- Async and sync IPC
- Event handling and channels
- IPC通信方法(ipcMain、ipcRenderer)
- 消息发送与接收
- 异步与同步IPC
- 事件处理与通道
Window API (api/window-api.md
)
api/window-api.md窗口API (api/window-api.md
)
api/window-api.md- BrowserWindow creation and options
- Window management methods
- Window events
- Window lifecycle
- BrowserWindow创建与配置项
- 窗口管理方法
- 窗口事件
- 窗口生命周期
Configuration API (api/config-api.md
)
api/config-api.md配置API (api/config-api.md
)
api/config-api.md- Configuration file structure
- App info configuration
- Window configuration
- Plugin configuration
- Environment variables
To use API reference:
- Identify the API you need help with
- Load the corresponding API file from the directory
api/ - Find the API signature, parameters, return type, and examples
- Reference the linked example files for detailed usage patterns
- All API files include links to relevant example files in the directory
examples/
- 配置文件结构
- 应用信息配置
- 窗口配置
- 插件配置
- 环境变量
使用API参考:
- 确定需要帮助的API
- 从目录加载对应的API文件
api/ - 查找API签名、参数、返回类型与示例
- 参考关联的示例文件获取详细使用模式
- 所有API文件均包含指向目录中相关示例文件的链接
examples/
Best Practices
最佳实践
- Separate processes: Keep main process and renderer process code separate
- Use IPC: Use IPC for inter-process communication
- Handle errors: Properly handle errors in both processes
- Security: Follow Electron security best practices
- Performance: Optimize application performance
- Build configuration: Configure build and package properly
- Plugin system: Use plugin system for extensibility
- 进程分离: 保持主进程与渲染进程代码分离
- 使用IPC: 通过IPC实现进程间通信
- 错误处理: 妥善处理两个进程中的错误
- 安全: 遵循Electron安全最佳实践
- 性能: 优化应用性能
- 构建配置: 正确配置构建与打包
- 插件系统: 使用插件系统实现扩展
Resources
资源
- Official Documentation: https://www.kaka996.com/
- Usage Guide: https://www.kaka996.com/pages/987b1c/
- API Documentation: https://www.kaka996.com/pages/a99b72/
- Gitee Repository: https://gitee.com/dromara/electron-egg
Keywords
关键词
Electron EGG, electron-egg, Electron, Egg.js, desktop application, 桌面应用, 主进程, 渲染进程, IPC, 进程间通信, 窗口管理, 菜单, 系统托盘, 自动更新, 插件系统, main process, renderer process, inter-process communication, window management, menu, system tray, auto updater, plugin system
Electron EGG, electron-egg, Electron, Egg.js, desktop application, 桌面应用, 主进程, 渲染进程, IPC, 进程间通信, 窗口管理, 菜单, 系统托盘, 自动更新, 插件系统, main process, renderer process, inter-process communication, window management, menu, system tray, auto updater, plugin system