[TypeScript] Add types to loot-core app (#4155)

* Add types to loot-core app

* Release notes

---------

Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>
This commit is contained in:
Joel Jeremy Marquez
2025-01-17 09:26:47 -08:00
committed by GitHub
parent 4bfb64cdfc
commit f07ad1f8c6
2 changed files with 13 additions and 4 deletions

View File

@@ -14,16 +14,19 @@ type Events = {
'load-budget': { id: string };
};
type UnlistenService = () => void;
type Service = () => UnlistenService;
class App<Handlers> {
events: Emitter<Events>;
handlers: Handlers;
services;
unlistenServices;
services: Service[];
unlistenServices: UnlistenService[];
constructor() {
this.handlers = {} as Handlers;
this.services = [];
this.events = mitt();
this.events = mitt<Events>();
this.unlistenServices = [];
}
@@ -39,7 +42,7 @@ class App<Handlers> {
this.handlers[name] = func;
}
service(func) {
service(func: Service) {
this.services.push(func);
}

View File

@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [joel-jeremy]
---
Add types to loot-core app