Gbiner_local / EventBus
0 curtidas
0 bifurcações
1 arquivos
Última atividade 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 |
Gbiner_local / 地面四叉树
0 curtidas
0 bifurcações
1 arquivos
Última atividade 2 years ago
Typescript实现得地面四叉树
| 1 | const CELLSIZE = 50; |
| 2 | |
| 3 | // 四叉树 |
| 4 | export class QuadTreeNode<T> { |
| 5 | private _x: number; |
| 6 | private _y: number; |
| 7 | private _width: number; |
| 8 | private _height: number; |
| 9 | private _children: QuadTreeNode<T>[] | null; |
| 10 | private _value: T | null; |
Próximo
Anterior