delay
type delay = (wait: number) => <T>(stream: Observable<T>) => Observable<T>
stream: -a-b-c-d-|
delay(2)(stream): ---a-b-c-d-|
Delay stream
events by wait
milliseconds. Maintains the relative spacing of events. Doesn't delay error event.
import { of } from 'light-observable/observable'
import { delay } from 'light-observable/operators'
const stream = of(1, 2, 3).pipe(
delay(1000)
)
stream.subscribe(console.log)
/*
Second after:
-> 1
-> 2
-> 3
*/
Also available as an Observable creator:
import { delay, of } from 'light-observable/observable'
const stream = delay(1000, of(1, 2, 3))
stream.subscribe(console.log)
/*
Second after:
-> 1
-> 2
-> 3
*/