UNPKG

929 BTypeScriptView Raw
1import { ContainerInstance } from "../ContainerInstance";
2/**
3 * Used to register special "handler" which will be executed on a service class during its initialization.
4 * It can be used to create custom decorators and set/replace service class properties and constructor parameters.
5 */
6export interface Handler {
7 /**
8 * Service object used to apply handler to.
9 */
10 object: Object;
11 /**
12 * Class property name to set/replace value of.
13 * Used if handler is applied on a class property.
14 */
15 propertyName?: string;
16 /**
17 * Parameter index to set/replace value of.
18 * Used if handler is applied on a constructor parameter.
19 */
20 index?: number;
21 /**
22 * Factory function that produces value that will be set to class property or constructor parameter.
23 * Accepts container instance which requested the value.
24 */
25 value: (container: ContainerInstance) => any;
26}