Home > ISCH_PrimitivePin > isAsync
ISCH_PrimitivePin.isAsync() method
查询图元是否为异步图元
签名
typescript
public isAsync(): boolean;1
返回值
boolean
是否为异步图元
示例
javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 在符号画布上创建一个测试引脚(默认异步模式)
const pin = await eda.sch_PrimitivePin.create(400, 300, '1', 'CLK', 0, 10, null, 'None', 'IN');
const asyncByDefault = pin.isAsync();
// 2. 转同步后再查,模式变为 false
const syncPin = pin.toSync();
const afterToSync = syncPin.isAsync();
// 3. 再转回异步,模式恢复 true
const asyncAgain = syncPin.toAsync();
const afterToAsync = asyncAgain.isAsync();
// 4. 清理测试引脚(查询类需要清理)
await eda.sch_PrimitivePin.delete([pin.getState_PrimitiveId()]);
console.log('asyncByDefault:', asyncByDefault);
console.log('afterToSync:', afterToSync);
console.log('afterToAsync:', afterToAsync);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24