Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 1.25 KB

delay.md

File metadata and controls

32 lines (24 loc) · 1.25 KB

delay

연산자(operator) 정의: delay(delay: number | Date, scheduler: Scheduler): Observable

Delay emitted values by given time.

Examples

Example 1: Delay for increasing durations

( jsBin | jsFiddle )

//emit one item
const example = Rx.Observable.of(null);
//delay output of each by an extra second
const message = Rx.Observable.merge(
    example.mapTo('Hello'),
    example.mapTo('World!').delay(1000),
    example.mapTo('Goodbye').delay(2000),
    example.mapTo('World!').delay(3000)
  );
//output: 'Hello'...'World!'...'Goodbye'...'World!'
const subscribe = message.subscribe(val => console.log(val));

Additional Resources


📁 Source Code: https://github.com/ReactiveX/rxjs/blob/master/src/operator/delay.ts