con un clic
easyeda-extension-iframe-communication
// Use when designing, implementing, or reviewing EasyEDA extensions that involve IFrame windows, cross-context communication, runtime eda access, resource packaging, and API invocation boundaries.
// Use when designing, implementing, or reviewing EasyEDA extensions that involve IFrame windows, cross-context communication, runtime eda access, resource packaging, and API invocation boundaries.
Use when packaging, auditing, or preparing a 嘉立创EDA / EasyEDA extension for submission, including extension.json completeness, icon requirements, entry validation, README and CHANGELOG checks, privacy review, and pre-release packaging readiness.
EasyEDA Pro API skill for AI agents. Use when working with EasyEDA Pro EDA software, including PCB design, schematic editing, footprint/symbol management, and project operations. Supports live debugging in EasyEDA and EasyEDA extension development. Provides complete API reference (120+ classes, 62 enums, 70 interfaces), extension-development documentation, and a WebSocket bridge server to execute code in the running EasyEDA Pro client. Trigger on: "嘉立创EDA,启动!", "立创EDA,启动!", "EDA,启动!", "EasyEDA", "PCB", "schematic", "footprint", "EDA", "circuit board", "嘉立创EDA", "原理图", "PCB设计". **IMPORTANT**: 嘉立创EDA's English name is **EasyEDA**. They are the SAME product. Never use other transliterations like "EasyEDA Pro" (unless specifically versioned), "EASYEDA", "easyeda", etc. Always use "EasyEDA" for English references and "嘉立创EDA" for Chinese references.
Use when debugging 嘉立创EDA extensions, using the runtime eda object, testing logic with independent scripts, loading IFrame windows, recovering from broken extensions, or explaining API stability rules.
Use when creating a new EasyEDA extension from a proven menu plus registerFn plus IFrame template, especially when you want a copyable host entry, iframe page structure, and direct eda API usage pattern inspired by the generate-silkscreen demo extension.
Use when creating or reviewing a 嘉立创EDA extension manifest, writing extension.json, configuring headerMenus, or wiring registerFn exports for EasyEDA extensions.
| name | easyeda-extension-iframe-communication |
| description | Use when designing, implementing, or reviewing EasyEDA extensions that involve IFrame windows, cross-context communication, runtime eda access, resource packaging, and API invocation boundaries. |
Design EasyEDA extension UI architecture with clear boundaries between host runtime, IFrame UI, communication, and API ownership.
Use this skill when the user asks about:
IFrame windowsys_MessageBusIFrame loading, missing eda, or unstable cross-context communicationDo not use this skill as the main API reference.
easyeda-api for class, method, enum, and interface lookupeasyeda-extension-debugging for debug mode, safety mode, and independent script workfloweasyeda-extension-manifest for extension.json, headerMenus, and registerFnThink of the extension as a shop:
The main rule is simple:
Choose IFrame when you need:
Do not choose IFrame when you only need:
Important limits:
SYS_IFrame belongs to real extension runtime, not independent script runtime/iframe/idChoose the interaction model based on runtime boundaries, not personal preference.
Use direct API calls when:
Good fit:
Use sys_MessageBus when:
Good fit:
Use this order:
Do not introduce a bus just to make local calls look abstract.
eda Access Ruleseda is runtime-injected, not a generic global you owneda is shared across all runtimes or all executionseda.sys_IFrame.openIFrame(...)Recommended rule:
eda firstparent.eda access as a compatibility fallback, not a core architecture guaranteeIf your design only works because parent.eda happens to be reachable, the design is too fragile.
Use one of these two models on purpose.
Best when:
Pattern:
Best when:
Pattern:
Avoid a design where:
parent.edaPick one primary path per feature.
Recommended structure:
src/
index.ts
application/
commands.ts
panel/
open-panel.ts
iframe/
index.ts
panel-api.ts
state.ts
render-*.ts
iframe/
index.html
index.css
config/
esbuild.common.ts
Recommended responsibilities:
src/index.ts: exported registerFn entrypointssrc/application/panel/open-panel.ts: showIFrame / openIFrame policysrc/iframe/index.ts: page bootstrap and event bindingsrc/iframe/panel-api.ts: page-facing façade over shared logiciframe/index.html: static shell onlyconfig/esbuild.common.ts: host bundle and IFrame bundle entriesKeep browser UI logic in src/iframe/ and keep /iframe/ as static assets and HTML entry.
/dist/iframe.jsiframe/index.html stable and lightweight.js files if the project already has TypeScript build infrastructureRecommended flow:
const entryPoints = {
index: './src/index',
iframe: './src/iframe/index',
};
<script src="/dist/iframe.js"></script>
This keeps runtime behavior predictable and keeps page logic reviewable in TypeScript.
Prefer this open pattern:
const shown = await eda.sys_IFrame.showIFrame(PANEL_ID);
if (!shown) {
await eda.sys_IFrame.openIFrame('/iframe/index.html', 1200, 760, PANEL_ID, {
title: 'My Panel',
maximizeButton: true,
minimizeButton: true,
});
}
Why this is safer:
If you do use sys_MessageBus, keep it thin and explicit.
Good contract shape:
Good patterns:
Bad patterns:
SYS_IFrame behavior only inside independent scriptsCheck in this order:
iframe/index.html path is package-root relativeshowIFrame and openIFrame use the same stable ideda exists in the expected runtimeManual validation sequence:
If the extension becomes broken or blocks the UI, use safety mode:
https://pro.lceda.cn/editor?safetyMode=true
When a user asks how to build an EasyEDA extension with an IFrame, answer in this order:
IFrameeasyeda-api for exact API lookupeasyeda-extension-debugging for debug mode and recovery floweasyeda-extension-manifest for extension.json and registerFn