scheduleObservable.js 1.0 KB

123456789101112131415161718192021
  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. function scheduleObservable(input, scheduler) {
  7. return new Observable_1.Observable(function (subscriber) {
  8. var sub = new Subscription_1.Subscription();
  9. sub.add(scheduler.schedule(function () {
  10. var observable = input[observable_1.observable]();
  11. sub.add(observable.subscribe({
  12. next: function (value) { sub.add(scheduler.schedule(function () { return subscriber.next(value); })); },
  13. error: function (err) { sub.add(scheduler.schedule(function () { return subscriber.error(err); })); },
  14. complete: function () { sub.add(scheduler.schedule(function () { return subscriber.complete(); })); },
  15. }));
  16. }));
  17. return sub;
  18. });
  19. }
  20. exports.scheduleObservable = scheduleObservable;
  21. //# sourceMappingURL=scheduleObservable.js.map