subjectize
Version:
TypeScript decorators for binding RxJS Subject with class properties
16 lines (15 loc) • 528 B
TypeScript
/**
* Make a {@link Subject}-like property that watches the value of the property `keyToWatch`.
*
* @remarks
* Users must initialize the property in the class definition.
* Recommend using {@link ReplaySubject} to initialize the property. Thus we don't need to
* set Subject's initial value and new subscribers can get current value.
*
* E.g.
* ```
* @Subjectize('someProp')
* public someProp$ = new ReplaySubject<SomeProp>(1);
* ```
*/
export declare function Subjectize<T>(keyToWatch: string): PropertyDecorator;