##// END OF EJS Templates
working on IoC configuration
working on IoC configuration

File last commit:

r114:475b8ce3e850 ioc ts support
r114:475b8ce3e850 ioc ts support
Show More
Box.ts
35 lines | 690 B | video/mp2t | TypeScriptLexer
cin
working on IoC configuration
r114 import { services } from "../di/Annotations";
import { Bar } from "./Bar";
cin
Initial work on typescript support for the container configuration
r107
cin
working on IoC configuration
r114 // declare required dependencies
const config = services<{
bar: Bar;
}>();
// export service descriptor
export const service = config.build<Box<Bar>>();
cin
Initial work on typescript support for the container configuration
r107
cin
Working on IoC container configuration
r111 @service.consume(config.dependency("bar"))
cin
working on di decorators
r109 export class Box<T> {
private _value: T | undefined;
cin
dependency builder proposal
r108
cin
working on di decorators
r109 constructor(value: T) {
this._value = value;
}
cin
Initial work on typescript support for the container configuration
r107
cin
dependency builder proposal
r110 @service.inject("bar")
cin
Initial work on typescript support for the container configuration
r107 setValue(value: T) {
this._value = value;
}
cin
working on di decorators
r109 setObj(value: object) {
}
cin
Initial work on typescript support for the container configuration
r107 getValue() {
cin
working on di decorators
r109 if (this._value === undefined)
throw new Error("Trying to get a value from the empty box");
cin
Initial work on typescript support for the container configuration
r107 return this._value;
}
cin
working on IoC configuration
r114 }