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.

fromObservable.js 1.0KB

123456789101112131415161718192021222324
  1. import { Observable } from '../Observable';
  2. import { Subscription } from '../Subscription';
  3. import { observable as Symbol_observable } from '../symbol/observable';
  4. import { subscribeToObservable } from '../util/subscribeToObservable';
  5. export function fromObservable(input, scheduler) {
  6. if (!scheduler) {
  7. return new Observable(subscribeToObservable(input));
  8. }
  9. else {
  10. return new Observable(subscriber => {
  11. const sub = new Subscription();
  12. sub.add(scheduler.schedule(() => {
  13. const observable = input[Symbol_observable]();
  14. sub.add(observable.subscribe({
  15. next(value) { sub.add(scheduler.schedule(() => subscriber.next(value))); },
  16. error(err) { sub.add(scheduler.schedule(() => subscriber.error(err))); },
  17. complete() { sub.add(scheduler.schedule(() => subscriber.complete())); },
  18. }));
  19. }));
  20. return sub;
  21. });
  22. }
  23. }
  24. //# sourceMappingURL=fromObservable.js.map