1 import { MonoTypeOperatorFunction, SchedulerLike } from '../types';
3 * Delays the emission of items from the source Observable by a given timeout or
6 * <span class="informal">Time shifts each item by some specified amount of
11 * If the delay argument is a Number, this operator time shifts the source
12 * Observable by that amount of time expressed in milliseconds. The relative
13 * time intervals between the values are preserved.
15 * If the delay argument is a Date, this operator time shifts the start of the
16 * Observable execution until the given date occurs.
19 * Delay each click by one second
21 * import { fromEvent } from 'rxjs';
22 * import { delay } from 'rxjs/operators';
24 * const clicks = fromEvent(document, 'click');
25 * const delayedClicks = clicks.pipe(delay(1000)); // each click emitted after 1 second
26 * delayedClicks.subscribe(x => console.log(x));
29 * Delay all clicks until a future date happens
31 * import { fromEvent } from 'rxjs';
32 * import { delay } from 'rxjs/operators';
34 * const clicks = fromEvent(document, 'click');
35 * const date = new Date('March 15, 2050 12:00:00'); // in the future
36 * const delayedClicks = clicks.pipe(delay(date)); // click emitted only after that date
37 * delayedClicks.subscribe(x => console.log(x));
40 * @see {@link debounceTime}
41 * @see {@link delayWhen}
43 * @param {number|Date} delay The delay duration in milliseconds (a `number`) or
44 * a `Date` until which the emission of the source items is delayed.
45 * @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for
46 * managing the timers that handle the time-shift for each item.
47 * @return {Observable} An Observable that delays the emissions of the source
48 * Observable by the specified timeout or Date.
52 export declare function delay<T>(delay: number | Date, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;