Comparing version 0.0.32 to 0.0.33
@@ -0,0 +0,0 @@ import { Injector } from './injector'; |
@@ -0,0 +0,0 @@ export class Annotations { |
@@ -0,0 +0,0 @@ import { Annotations, ClassDecoratorContextCallback, PropertyDecoratorContextCallback } from './annotations'; |
@@ -0,0 +0,0 @@ import { Annotations } from './annotations'; |
@@ -0,0 +0,0 @@ export declare class ForwardRef<T = any> { |
@@ -0,0 +0,0 @@ export class ForwardRef { |
@@ -0,0 +0,0 @@ export interface Injectable { |
@@ -0,0 +0,0 @@ import { makeClassDecorator } from './decorators'; |
@@ -0,0 +0,0 @@ export declare class InjectionToken<T> { |
@@ -0,0 +0,0 @@ export class InjectionToken { |
@@ -0,0 +0,0 @@ import { Type } from './type'; |
@@ -0,0 +0,0 @@ export var InjectFlags; |
@@ -0,0 +0,0 @@ import { Type } from './type'; |
@@ -0,0 +0,0 @@ import { makeParamDecorator, makePropertyDecorator } from './decorators'; |
@@ -0,0 +0,0 @@ import { Injector } from './injector'; |
@@ -0,0 +0,0 @@ import { makeInjectError } from './utils/_api'; |
@@ -0,0 +0,0 @@ import { Type } from './type'; |
export {}; |
@@ -0,0 +0,0 @@ import { Provider } from './provider'; |
@@ -0,0 +0,0 @@ import { InjectFlags, Injector } from './injector'; |
@@ -0,0 +0,0 @@ import { Provider } from './provider'; |
@@ -0,1 +1,2 @@ | ||
import { InjectFlags } from './injector'; | ||
import { Inject, Optional, Self, SkipSelf } from './metadata'; | ||
@@ -50,2 +51,8 @@ import { getAnnotations } from './decorators'; | ||
return function (...args) { | ||
if (provider.provide !== provider.useClass) { | ||
const cachedInstance = injector.get(provider.useClass, null, InjectFlags.Optional); | ||
if (cachedInstance) { | ||
return cachedInstance; | ||
} | ||
} | ||
const instance = new provider.useClass(...args); | ||
@@ -59,3 +66,6 @@ const propMetadataKeys = getAnnotations(provider.useClass).getPropMetadataKeys(); | ||
}); | ||
cacheFn(provider.useClass, instance); | ||
cacheFn(provider.provide, instance); | ||
if (provider.provide !== provider.useClass) { | ||
cacheFn(provider.provide, instance); | ||
} | ||
return instance; | ||
@@ -62,0 +72,0 @@ }; |
@@ -0,0 +0,0 @@ export declare const Type: FunctionConstructor; |
export const Type = Function; |
export * from './inject-error'; | ||
export * from './stringify'; |
export * from './inject-error'; | ||
export * from './stringify'; |
export declare function makeInjectError(name: string): (token: any) => Error; |
@@ -0,0 +0,0 @@ import { stringify } from './stringify'; |
export declare function stringify(token: any): string; |
@@ -0,0 +0,0 @@ export function stringify(token) { |
@@ -0,0 +0,0 @@ export * from './core/utils/_api'; |
@@ -0,0 +0,0 @@ export * from './core/utils/_api'; |
{ | ||
"name": "@tanbo/di", | ||
"version": "0.0.32", | ||
"version": "0.0.33", | ||
"description": "A dependency injection Library", | ||
@@ -5,0 +5,0 @@ "main": "./bundles/public-api.js", |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
692
26101