Home > @esengine/ecs-framework-monorepo > EventBus > onAsync
EventBus.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 | (Optional) 监听器配置 |
Returns:
string
监听器ID