Home > SYS_I18n > isEventListenerAlreadyExist
SYS_I18n.isEventListenerAlreadyExist() method
Query whether the event listener exists
Signature
typescript
function isEventListenerAlreadyExist(id: string): boolean;1
Parameters
Parameter | Type | Description |
|---|---|---|
id | string | Event ID |
Returns
boolean
Whether the event listener exists
Example
javascript
// 1. 注册一个测试监听作为查询对象
eda.sys_I18n.addLanguageChangedEventListener('嘉立创示例_查询监听', () => {}, false);
// 2. 查询已注册与未注册的 ID
console.log('已注册的 ID 存在:', eda.sys_I18n.isEventListenerAlreadyExist('嘉立创示例_查询监听'));
console.log('未注册的 ID 存在:', eda.sys_I18n.isEventListenerAlreadyExist('嘉立创示例_未注册'));
// 3. 清理测试监听
eda.sys_I18n.removeEventListener('嘉立创示例_查询监听');
console.log('已清理测试监听');1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10