mirror of
https://github.com/DaanVandenBosch/phantasmal-world.git
synced 2025-04-04 22:58:29 +08:00
19 lines
514 B
TypeScript
19 lines
514 B
TypeScript
import { Disposable } from "../observable/Disposable";
|
|
import { Disposer } from "../observable/Disposer";
|
|
|
|
export abstract class Controller implements Disposable {
|
|
private readonly disposer = new Disposer();
|
|
|
|
dispose(): void {
|
|
this.disposer.dispose();
|
|
}
|
|
|
|
protected disposable<T extends Disposable>(disposable: T): T {
|
|
return this.disposer.add(disposable);
|
|
}
|
|
|
|
protected disposables(...disposables: Disposable[]): void {
|
|
this.disposer.add_all(...disposables);
|
|
}
|
|
}
|