Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {Observable} from '@reactivex/rxjs'
import counterStore from './counterStore'
import routerStore from './routerStore'
// You can enter more stores here
export default Observable.combineLatest(counterStore,
routerStore,
(counterStore,
routerStore) => {
return Object.assign({},
counterStore,
routerStore)
})
constructor(destination: Subscriber, private _self: Observable, private _pauser: Observable) {
super(destination);
let previousShouldFire: boolean;
destination.add(
Observable.combineLatest(_self, _pauser)
.subscribe(([data, shouldFire]) => {
if (previousShouldFire !== undefined && shouldFire !== previousShouldFire) {
previousShouldFire = shouldFire;
// change in shouldFire
if (shouldFire) { this._drainQueue(); }
} else {
previousShouldFire = shouldFire;
// new data
if (shouldFire) {
this._next(data);
} else {
this._queue.push(data);
}
}
}, e => {
this._drainQueue();