feat: basecontroller

This commit is contained in:
Gabriellvl 2025-03-21 23:50:57 +01:00
parent 4cceed3ea9
commit 47a522e443
6 changed files with 108 additions and 36 deletions

View file

@ -0,0 +1,14 @@
import {ThemeController} from "@/controllers/themes.ts";
export function controllerGetter<T>(Factory: new () => T): () => T {
let instance: T | undefined;
return (): T => {
if (!instance) {
instance = new Factory();
}
return instance;
};
}
export const getThemeController = controllerGetter(ThemeController);