import * as plugins from './smartdata.plugins.js'; /** * a wrapper for the native mongodb cursor. Exposes better */ export class SmartdataDbWatcher { // STATIC // INSTANCE public changeStream: plugins.mongodb.ChangeStream; public changeSubject = new plugins.smartrx.rxjs.Subject(); constructor(changeStreamArg: plugins.mongodb.ChangeStream) { this.changeStream = changeStreamArg; this.changeStream.on('change', (item: T) => { this.changeSubject.next(item); }) } public async close() { await this.changeStream.close(); } }