##// END OF EJS Templates
sync
sync

File last commit:

r115:691199f665e0 ioc ts support
r116:e81085d00fcb ioc ts support
Show More
Box.ts
35 lines | 714 B | video/mp2t | TypeScriptLexer
// import { services } from "../di/Annotations";
// import { Bar } from "./Bar";
// declare required dependencies
// const config = services<{
// bar: Bar;
// }>();
// export service descriptor
// export const service = config.build<Box<Bar>>();
// @service.consume(config.dependency("bar"))
export class Box<T> {
private _value: T | undefined;
constructor(value: T) {
this._value = value;
}
// @service.inject("bar")
setValue(value: T) {
this._value = value;
}
setObj(value: object) {
}
getValue() {
if (this._value === undefined)
throw new Error("Trying to get a value from the empty box");
return this._value;
}
}