Home > SYS_IFrame > hideIFrame
SYS_IFrame.hideIFrame() 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.
Hide iframe window
Signature
typescript
function hideIFrame(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 hidden |
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 hidden 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. 隐藏该窗口(窗口从界面消失,但未被销毁)
const hidden = await eda.sys_IFrame.hideIFrame('嘉立创示例_隐藏演示');
console.log('隐藏结果:', hidden);
// 3. 对已隐藏的窗口再次隐藏,验证幂等语义(返回 true)
const hideAgain = await eda.sys_IFrame.hideIFrame('嘉立创示例_隐藏演示');
console.log('重复隐藏结果:', hideAgain);
// 4. 对不存在的窗口 ID 隐藏,结果导向返回 false(不抛错)
const hideMissing = await eda.sys_IFrame.hideIFrame('嘉立创示例_不存在的窗口');
console.log('不存在的窗口 ID →', hideMissing);
// 5. 关闭隐藏状态的窗口还原界面(隐藏的窗口可直接关闭)
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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21