Skip to content

Home > @esengine/ecs-framework-monorepo > IEventBus > onAsync

IEventBus.onAsync() method

异步监听事件

Signature:

typescript
onAsync<T>(eventType: string, handler: (data: T) => Promise<void>, config?: IEventListenerConfig): string;

Parameters

Parameter

Type

Description

eventType

string

事件类型

handler

(data: T) => Promise<void>

异步事件处理器

config

IEventListenerConfig

(Optional) 监听器配置

Returns:

string

监听器ID

基于 MIT 许可证发布