contexify
Version:
A TypeScript library providing a powerful dependency injection container with context-based IoC capabilities, inspired by LoopBack's Context system.
56 lines (53 loc) • 1.5 kB
TypeScript
import '../index-CSgk2Bzc.js';
import { BindingSpec } from './binding-inspector.js';
import './binding-key.js';
import 'events';
import '../provider/provider.js';
import '../utils/value-promise.js';
import 'metarize';
import '../utils/json-types.js';
import '../utils/debug.js';
/**
* Decorate a class with binding configuration
*
* @example
* ```ts
* @injectable((binding) => {binding.inScope(BindingScope.SINGLETON).tag('controller')}
* )
* @injectable({scope: BindingScope.SINGLETON})
* export class MyController {
* }
* ```
*
* @param specs - A list of binding scope/tags or template functions to
* configure the binding
*/
declare function injectable(...specs: BindingSpec[]): ClassDecorator;
/**
* A namespace to host shortcuts for `@injectable`
*/
declare namespace injectable {
/**
* `@injectable.provider` to denote a provider class
*
* A list of binding scope/tags or template functions to configure the binding
*/
function provider(...specs: BindingSpec[]): (target: any) => void;
}
/**
* `@bind` is now an alias to {@link injectable} for backward compatibility
* {@inheritDoc injectable}
*/
declare function bind(...specs: BindingSpec[]): ClassDecorator;
/**
* Alias namespace `bind` to `injectable` for backward compatibility
*
* It should have the same members as `bind`.
*/
declare namespace bind {
/**
* {@inheritDoc injectable.provider}
*/
const provider: typeof injectable.provider;
}
export { bind, injectable };