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

123456789101112131415161718192021222324252627
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var Observable_1 = require("../Observable");
  4. var Subscription_1 = require("../Subscription");
  5. var observable_1 = require("../symbol/observable");
  6. var subscribeToObservable_1 = require("../util/subscribeToObservable");
  7. function fromObservable(input, scheduler) {
  8. if (!scheduler) {
  9. return new Observable_1.Observable(subscribeToObservable_1.subscribeToObservable(input));
  10. }
  11. else {
  12. return new Observable_1.Observable(function (subscriber) {
  13. var sub = new Subscription_1.Subscription();
  14. sub.add(scheduler.schedule(function () {
  15. var observable = input[observable_1.observable]();
  16. sub.add(observable.subscribe({
  17. next: function (value) { sub.add(scheduler.schedule(function () { return subscriber.next(value); })); },
  18. error: function (err) { sub.add(scheduler.schedule(function () { return subscriber.error(err); })); },
  19. complete: function () { sub.add(scheduler.schedule(function () { return subscriber.complete(); })); },
  20. }));
  21. }));
  22. return sub;
  23. });
  24. }
  25. }
  26. exports.fromObservable = fromObservable;
  27. //# sourceMappingURL=fromObservable.js.map