The behavior of delay
has changed in RxJs 7. While I understand the reasoning for the change, it was useful for a demo project that I use to simulate over-the-wire API delays. In RxJs 6, the code below would only log to the console after the 5 second delay, but in 7 it is immediately logged (7 no longer waits for delays on an empty observable). Is there a way to replicate the following in RxJs 7?
import { EMPTY } from 'rxjs';
import { delay } from 'rxjs/operators';
EMPTY.pipe(delay(5000)).subscribe({
complete: () => {
console.log('complete');
},
});
See the Stackblitz examples below.
RxJs 7 (no delay): https://stackblitz.com/edit/rxjs-yx19nb?file=index.ts RxJS 6 (5 second delay): https://stackblitz.com/edit/rxjs-8rmhov?file=index.ts