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.2KB

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