fix(watcher.changeSubject): now emits correct type into observer functions
This commit is contained in:
parent
055298172f
commit
206ccd40e9
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@pushrocks/smartdata',
|
name: '@pushrocks/smartdata',
|
||||||
version: '5.0.2',
|
version: '5.0.3',
|
||||||
description: 'do more with data'
|
description: 'do more with data'
|
||||||
}
|
}
|
||||||
|
@ -11,11 +11,11 @@ export class SmartdataDbWatcher<T = any> {
|
|||||||
// INSTANCE
|
// INSTANCE
|
||||||
private changeStream: plugins.mongodb.ChangeStream<T>;
|
private changeStream: plugins.mongodb.ChangeStream<T>;
|
||||||
|
|
||||||
public changeSubject = new plugins.smartrx.rxjs.Subject<SmartDataDbDoc<T, T>>();
|
public changeSubject = new plugins.smartrx.rxjs.Subject<T>();
|
||||||
constructor(changeStreamArg: plugins.mongodb.ChangeStream<T>, smartdataDbDocArg: typeof SmartDataDbDoc) {
|
constructor(changeStreamArg: plugins.mongodb.ChangeStream<T>, smartdataDbDocArg: typeof SmartDataDbDoc) {
|
||||||
this.changeStream = changeStreamArg;
|
this.changeStream = changeStreamArg;
|
||||||
this.changeStream.on('change', async (item: T) => {
|
this.changeStream.on('change', async (item: T) => {
|
||||||
this.changeSubject.next(smartdataDbDocArg.createInstanceFromMongoDbNativeDoc(item));
|
this.changeSubject.next(smartdataDbDocArg.createInstanceFromMongoDbNativeDoc(item) as any as T);
|
||||||
})
|
})
|
||||||
plugins.smartdelay.delayFor(0).then(() => {
|
plugins.smartdelay.delayFor(0).then(() => {
|
||||||
this.readyDeferred.resolve();
|
this.readyDeferred.resolve();
|
||||||
|
Loading…
Reference in New Issue
Block a user