##// END OF EJS Templates
Added tag v1.4.0 for changeset 1a8a956a013f
Added tag v1.4.0 for changeset 1a8a956a013f

File last commit:

r134:511bcc634d65 ioc ts support
r157:f563f4b24ce3 default
Show More
Box.ts
28 lines | 682 B | video/mp2t | TypeScriptLexer
import { Bar } from "./Bar";
// export service descriptor
// через service передается информация о типе зависимости
// даже если это шаблон.
// export const service = annotate<Box<Bar>>();
// @service.wire()
export class Box<T> {
private _value: T | undefined;
constructor(value?: T) {
this._value = value;
}
// @service.inject(dependency("bar"))
setValue(value: T) {
this._value = value;
return value;
}
getValue() {
if (this._value === undefined)
throw new Error("Trying to get a value from the empty box");
return this._value;
}
}