Home > SYS_IFrame > showIFrame
SYS_IFrame.showIFrame() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Show iframe window
Signature
typescript
function showIFrame(id?: string): Promise<boolean>;1
Parameters
Parameter | Type | Description |
|---|---|---|
id | string | (Optional) Iframe window ID. If not passed in, all iframe windows associated with the extension will be shown |
Returns
Promise<boolean>
Whether the operation is successful
Remarks
This API is result-oriented: If the specified iframe window is not found, the API returns false; if the iframe window was already in the shown state before the operation, the API returns true
Note: This API is only valid for extensions. Calling it in a standalone script environment will always throw Error
Example
javascript
// 1. 打开一个内联框架窗口(自建 fixture)
const opened = await eda.sys_IFrame.openIFrame('/extension.json', 320, 200, '嘉立创示例_显示演示', {
title: '嘉立创示例 显示演示窗口',
});
console.log('打开结果:', opened);
// 2. 先隐藏窗口,制造"待恢复"状态
await eda.sys_IFrame.hideIFrame('嘉立创示例_显示演示');
console.log('已隐藏窗口,准备恢复显示');
// 3. 显示该窗口(从隐藏状态恢复,界面重新可见)
const shown = await eda.sys_IFrame.showIFrame('嘉立创示例_显示演示');
console.log('显示结果:', shown);
// 4. 对已显示的窗口再次显示,验证幂等语义(返回 true)
const showAgain = await eda.sys_IFrame.showIFrame('嘉立创示例_显示演示');
console.log('重复显示结果:', showAgain);
// 5. 对不存在的窗口 ID 显示,结果导向返回 false(不抛错)
const showMissing = await eda.sys_IFrame.showIFrame('嘉立创示例_不存在的窗口');
console.log('不存在的窗口 ID →', showMissing);
// 6. 关闭窗口还原界面
const closed = await eda.sys_IFrame.closeIFrame('嘉立创示例_显示演示');
console.log('关闭结果:', closed);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25