🍎Container Options, extendability
You can configure the Container with
enableAutoCreate
When you call container.resolve / resolveByType etc. It will try to resolve with the registered dependencies and if the required dependency is not registered (.register, .registerByType..) it will throw an error, BUT you have the option to register types when resolution is happening (no need for registration). It will resolve Types automatically with the use of the @Injectable({instantiation: "singleton" | "prototype"}) decorator. Basically, it's like a strict mode you can choose.
Initializers
Initializers run after every instantiation. The container has some default initializatizers eg. @MethodWrapper(key: string | Type<IMethodWrapper>), @RunBefore(key: string | Type<IRunBefore>), @InitMethod() etc. You can create your own just implement the IInitializer interface:
Then add to the container:
Last updated