Gbiner_local / EventBus
0 beğeniler
0 çatallar
1 dosyalar
Son aktivite 2 years ago
Base on Typescript的EventBus
| 1 | type Callback = (...args: any[]) => void | Promise<void>; |
| 2 | |
| 3 | export class EventBus { |
| 4 | private static listeners = new Map<string, Callback[]>(); |
| 5 | private static onceListeners = new Map<string, Callback[]>(); |
| 6 | |
| 7 | /** |
| 8 | * 为指定事件注册一个回调,该回调将在每次触发时调用 |
| 9 | * @param event |
| 10 | * @param callback |
Daha yeni
Daha eski