mirror of
https://github.com/sern-handler/handler
synced 2026-06-27 18:22:14 +00:00
refactor deps list
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user