mirror of
https://github.com/sern-handler/handler
synced 2026-06-13 11:22:15 +00:00
fix error callbacks not being stored
This commit is contained in:
@@ -7,6 +7,7 @@ import { CoreModuleStore } from '../contracts';
|
||||
* For interacting with modules, use the ModuleManager instead.
|
||||
*/
|
||||
export class ModuleStore implements CoreModuleStore {
|
||||
onError = new WeakMap<Module, Function>();
|
||||
metadata = new WeakMap<Module, CommandMeta>();
|
||||
commands = new Map<string, string>();
|
||||
}
|
||||
|
||||
@@ -11,6 +11,13 @@ import { CommandType } from '../enums';
|
||||
export class DefaultModuleManager implements ModuleManager {
|
||||
constructor(private moduleStore: CoreModuleStore) {}
|
||||
|
||||
getErrorCallback(m: Module): Function | undefined {
|
||||
return this.moduleStore.onError.get(m);
|
||||
}
|
||||
setErrorCallback(m: Module, c: Function): void {
|
||||
this.moduleStore.onError.set(m, c);
|
||||
}
|
||||
|
||||
getByNameCommandType<T extends CommandType>(name: string, commandType: T) {
|
||||
const id = this.get(Id.create(name, commandType));
|
||||
if (!id) {
|
||||
|
||||
Reference in New Issue
Block a user