Runtime API / Method

RuntimeNode.on

在一个已解析的 RuntimeNode 上直接监听统一事件。

使用说明

适合宿主代码先通过 instance.scene.get()、queryAll() 或 findByName() 获得 live node handle 后绑定事件。返回的函数用于注销监听,Instance 销毁后 handle 不应继续复用。

Node Script 内优先使用 ctx.onNode() 或 ctx.delegate(),以获得脚本生命周期清理、role 解析和动态命名节点语义。

参数

eventUnifiedEventType
handlerUnifiedEventHandler
optionsEventListenerOptions