Box.ts
23 lines
| 465 B
| video/mp2t
|
TypeScriptLexer
|
|
r108 | import { Builder } from "../di/Annotations"; | ||
| import { Bar } from "./Bar"; | ||||
| import { Foo } from "./Foo"; | ||||
|
|
r107 | |||
| export interface Injector<T> { | ||||
| setValue(value: T); | ||||
| } | ||||
|
|
r108 | const builder = new Builder<Box<any>, { bar: Bar; foo: Foo}>(); | ||
| @builder.provides("barBox") | ||||
|
|
r107 | export class Box<T> implements Injector<T> { | ||
| private _value: T; | ||||
|
|
r108 | @builder.inject("bar") | ||
|
|
r107 | setValue(value: T) { | ||
| this._value = value; | ||||
| } | ||||
| getValue() { | ||||
| return this._value; | ||||
| } | ||||
| } | ||||
