1 | import { FactoryDefinition } from './factory';
|
2 | export interface RegistrationOptions {
|
3 | singleton?: boolean;
|
4 | instantiate?: boolean;
|
5 | }
|
6 | export interface Injection {
|
7 | property: string;
|
8 | source: string;
|
9 | }
|
10 | export interface RegistryWriter {
|
11 | register(specifier: string, factory: any, options?: RegistrationOptions): void;
|
12 | unregister(specifier: string): void;
|
13 | registerOption(specifier: string, option: string, value: any): void;
|
14 | unregisterOption(specifier: string, option: string): void;
|
15 | registerInjection(specifier: string, property: string, source: string): void;
|
16 | }
|
17 | export interface RegistryReader {
|
18 | registration(specifier: string): any;
|
19 | registeredOption(specifier: string, option: string): any;
|
20 | registeredOptions(specifier: string): any;
|
21 | registeredInjections(specifier: string): Injection[];
|
22 | }
|
23 | export interface RegistryOptions {
|
24 | fallback?: RegistryReader;
|
25 | }
|
26 | export interface RegistryAccessor extends RegistryReader, RegistryWriter {
|
27 | }
|
28 | export default class Registry implements RegistryAccessor {
|
29 | private _registrations;
|
30 | private _registeredOptions;
|
31 | private _registeredInjections;
|
32 | private _fallback;
|
33 | constructor(options?: RegistryOptions);
|
34 | register(specifier: string, factoryDefinition: FactoryDefinition<any>, options?: RegistrationOptions): void;
|
35 | registration(specifier: string): FactoryDefinition<any>;
|
36 | unregister(specifier: string): void;
|
37 | registerOption(specifier: string, option: string, value: any): void;
|
38 | registeredOption(specifier: string, option: string): any;
|
39 | registeredOptions(specifier: string): any;
|
40 | unregisterOption(specifier: string, option: string): void;
|
41 | registerInjection(specifier: string, property: string, source: string): void;
|
42 | registeredInjections(specifier: string): Injection[];
|
43 | }
|