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

File last commit:

r111:33420a95f637 ioc ts support
r114:475b8ce3e850 ioc ts support
Show More
Bar.ts
33 lines | 585 B | video/mp2t | TypeScriptLexer
import { Foo } from "./Foo";
import { config } from "./config";
const service = config.build("bar");
@service.consume({
f: config.dependency("foo"),
nested: {
lazy: config.lazy("foo")
}
})
export class Bar {
barName = "bar";
_v: Foo | undefined;
constructor(_opts: {
f: Foo;
nested: {
lazy: () => Foo
}
}) {
if (_opts && _opts.f)
this._v = _opts.f;
}
getFoo() {
if (this._v === undefined)
throw new Error("The foo isn't set");
return this._v;
}
}