English
Home > DMT_EditorControl > getDocumentReadyState
DMT_EditorControl.getDocumentReadyState() 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.
获取文档的就绪状态
Signature
typescript
function getDocumentReadyState(documentUuidOrTabId: string): Promise<EDMT_ProjectReadyState>;1
Parameters
Parameter | Type | Description |
|---|---|---|
documentUuidOrTabId | string | 文档 UUID 或标签页 ID |
Returns
Promise<EDMT_ProjectReadyState>
指定文档的就绪状态
Remarks
返回指定文档的就绪阶段(未加载 / 加载中 / 就绪 / 失败),可用于多文档顺序加载的流程编排; 文档未打开、不存在或已关闭时返回 notLoaded
输入支持范围与就绪语义同 waitForDocumentReady ADD since EDA v4.1.79
Example
javascript
// 1. 打开一个原理图图页
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const tabId = await eda.dmt_EditorControl.openDocument(pages[0].uuid);
// 2. 轮询就绪状态直到就绪或超时
const deadline = Date.now() + 60000;
while (Date.now() < deadline) {
const state = await eda.dmt_EditorControl.getDocumentReadyState(tabId);
console.log('state:', state);
if (state === 'ready')
break;
await new Promise(r => setTimeout(r, 200));
}1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13