import { Observable } from '../Observable'; import { MonoTypeOperatorFunction } from '../interfaces'; /** * Delays the emission of items from the source Observable by a given time span * determined by the emissions of another Observable. * * It's like {@link delay}, but the time span of the * delay duration is determined by a second Observable. * * * * `delayWhen` time shifts each emitted value from the source Observable by a * time span determined by another Observable. When the source emits a value, * the `delayDurationSelector` function is called with the source value as * argument, and should return an Observable, called the "duration" Observable. * The source value is emitted on the output Observable only when the duration * Observable emits a value or completes. * * Optionally, `delayWhen` takes a second argument, `subscriptionDelay`, which * is an Observable. When `subscriptionDelay` emits its first value or * completes, the source Observable is subscribed to and starts behaving like * described in the previous paragraph. If `subscriptionDelay` is not provided, * `delayWhen` will subscribe to the source Observable as soon as the output * Observable is subscribed. * * @example