2022-10-14 18:25:50 +02:00
|
|
|
import { GlobalState } from "../models/domain/global-state";
|
2022-01-31 20:33:31 +01:00
|
|
|
|
|
|
|
export class GlobalStateFactory<T extends GlobalState = GlobalState> {
|
|
|
|
private globalStateConstructor: new (init: Partial<T>) => T;
|
|
|
|
|
|
|
|
constructor(globalStateConstructor: new (init: Partial<T>) => T) {
|
|
|
|
this.globalStateConstructor = globalStateConstructor;
|
|
|
|
}
|
|
|
|
|
|
|
|
create(args?: Partial<T>) {
|
|
|
|
return new this.globalStateConstructor(args);
|
|
|
|
}
|
|
|
|
}
|