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 933B

1234567891011121314151617181920212223242526272829
  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. * ```javascript
  11. * const click$ = fromEvent(button, 'click');
  12. *
  13. * clicks$.pipe(
  14. * takeUntil(timer(1000)),
  15. * throwIfEmpty(
  16. * () => new Error('the button was not clicked within 1 second')
  17. * ),
  18. * )
  19. * .subscribe({
  20. * next() { console.log('The button was clicked'); },
  21. * error(err) { console.error(err); },
  22. * });
  23. * ```
  24. *
  25. * @param {Function} [errorFactory] A factory function called to produce the
  26. * error to be thrown when the source observable completes without emitting a
  27. * value.
  28. */
  29. export declare const throwIfEmpty: <T>(errorFactory?: () => any) => MonoTypeOperatorFunction<T>;