Home > SCH_Event > addSimulationEnginePullEventListener
SCH_Event.addSimulationEnginePullEventListener() 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.
Register a simulation engine pull event listener
Signature
typescript
function addSimulationEnginePullEventListener(
id: string,
eventType: 'all',
callFn: (
eventType:
ESCH_DynamicSimulationEnginePullEventType | ESCH_SpiceSimulationEnginePullEventType,
props: Record<string, any>,
) => void | Promise<void>,
): void;1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
Parameters
Parameter | Type | Description |
|---|---|---|
id | string | Event ID, used to prevent duplicate event registration |
eventType | 'all' | Event type |
callFn | (eventType: ESCH_DynamicSimulationEnginePullEventType | ESCH_SpiceSimulationEnginePullEventType, props: Record<string, any>) => void | Promise<void> | The callback function triggered when the event fires |
Returns
void
Remarks
Note: This API is only valid for extensions. Calling it in a standalone script environment will always throw Error
Example
javascript
const listenerId = '嘉立创示例_sch_simulation_pull_event';
// 1. 注册仿真引擎拉取事件监听,eventType 固定传 'all'
eda.sch_Event.addSimulationEnginePullEventListener(
listenerId,
'all',
(eventType, props) => {
// 回调在仿真引擎拉取数据时触发
console.log('pullEvent:', eventType, JSON.stringify(props));
}
);
// 2. 回读确认注册成功
const registered = eda.sch_Event.isEventListenerAlreadyExist(listenerId);
console.log('registered:', registered);
// 3. 清理监听
const removed = eda.sch_Event.removeEventListener(listenerId);
console.log('removed:', removed);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19