Home > DMT_Event > addEditorTabEventListener
DMT_Event.addEditorTabEventListener() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
新增编辑器标签页事件监听
签名
typescript
addEditorTabEventListener(id: string, eventType: 'all' | EDMT_EditorTabEventType, callFn: (eventType: EDMT_EditorTabEventType, props: {
documentType: EDMT_EditorDocumentType;
title: string;
tabId: string;
}) => void | Promise<void>, onlyOnce?: boolean): void;1
2
3
4
5
2
3
4
5
参数名
参数 | 类型 | 描述 |
|---|---|---|
id | string | 事件 ID,用以防止重复注册事件 |
eventType | 'all' | EDMT_EditorTabEventType | 事件类型 |
callFn | (eventType: EDMT_EditorTabEventType, props: { documentType: EDMT_EditorDocumentType; title: string; tabId: string; }) => void | Promise<void> | 事件触发时的回调函数 |
onlyOnce | boolean | (可选) 是否仅监听一次 |
返回值
void
备注
注意:本接口仅扩展有效,在独立脚本环境内调用将始终 throw Error