Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

throwIfEmpty.d.ts 1023B

1234567891011121314151617181920212223242526272829303132
  1. import { MonoTypeOperatorFunction } from '../types';
  2. /**
  3. * If the source observable completes without emitting a value, it will emit
  4. * an error. The error will be created at that time by the optional
  5. * `errorFactory` argument, otherwise, the error will be {@link EmptyError}.
  6. *
  7. * ![](throwIfEmpty.png)
  8. *
  9. * ## Example
  10. * ```ts
  11. * import { fromEvent, timer } from 'rxjs';
  12. * import { throwIfEmpty, takeUntil } from 'rxjs/operators';
  13. *
  14. * const click$ = fromEvent(document, 'click');
  15. *
  16. * click$.pipe(
  17. * takeUntil(timer(1000)),
  18. * throwIfEmpty(
  19. * () => new Error('the document was not clicked within 1 second')
  20. * ),
  21. * )
  22. * .subscribe({
  23. * next() { console.log('The button was clicked'); },
  24. * error(err) { console.error(err); }
  25. * });
  26. * ```
  27. *
  28. * @param errorFactory A factory function called to produce the
  29. * error to be thrown when the source observable completes without emitting a
  30. * value.
  31. */
  32. export declare function throwIfEmpty<T>(errorFactory?: (() => any)): MonoTypeOperatorFunction<T>;