refactor deps list

This commit is contained in:
Jacob Nguyen
2024-05-15 00:29:59 -05:00
parent eb8ba6799b
commit ec45f80be6
10 changed files with 54 additions and 47 deletions

View File

@@ -1,7 +1,7 @@
import type { DependencyConfiguration } from '../../types/ioc';
import { Container } from './container';
import * as __Services from '../structures/default-services';
import { UnpackFunction } from '../../types/utility';
import { UnpackedDependencies } from '../../types/utility';
import type { Logging } from '../interfaces';
import { __add_container, __init_container, __swap_container, useContainerRaw } from './global';
@@ -12,9 +12,6 @@ export function disposeAll(logger: Logging|undefined) {
}
type UnpackedDependencies = {
[K in keyof Dependencies]: UnpackFunction<Dependencies[K]>
}
type Insertable =
| ((container: UnpackedDependencies) => unknown)
| object

View File

@@ -66,6 +66,10 @@ export class Container {
this.finished_init = true;
}
deps<T extends Record<string,any>>(): T {
return Object.fromEntries(this.__singletons) as T
}
async executeHooks(name: string) {
const hookFunctions = this.hooks.get(name) || [];
for (const hookFunction of hookFunctions) {