UNPKG

dino-core

Version:

A dependency injection framework for NodeJS applications

46 lines (45 loc) 1.1 kB
type Lifetime = 'SINGLETON' | 'TRANSIENT' | 'SCOPED'; /** * Define the possible scopes for an entity * @public * @class * @public * @type Scope */ export declare class Scope { /** * A single instance of the entity will be injected for all dependencies */ static SINGLETON: Scope; /** * A new instance of the entity is returned every time is requested */ static TRANSIENT: Scope; /** * A single instance per scope is available */ static SCOPED: Scope; private readonly id; private readonly primitive; constructor(id: string, primitive: Lifetime); getId(): string; /** * Convert the current scope to awilix Lifetime primitive * * @returns {awilix.Lifetime} * @public */ asPrimitive(): Lifetime; /** * Lookup a scope from it name * @param {String} name the name of the scope to lookup * * @returns {Scope} the {@link Scope} retrieved from it name * * @default Scope.SINGLETON * * @public */ static fromName(name: string): Scope; } export {};