schedulePromise.js 869 B

1234567891011121314151617181920
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var Observable_1 = require("../Observable");
  4. var Subscription_1 = require("../Subscription");
  5. function schedulePromise(input, scheduler) {
  6. return new Observable_1.Observable(function (subscriber) {
  7. var sub = new Subscription_1.Subscription();
  8. sub.add(scheduler.schedule(function () { return input.then(function (value) {
  9. sub.add(scheduler.schedule(function () {
  10. subscriber.next(value);
  11. sub.add(scheduler.schedule(function () { return subscriber.complete(); }));
  12. }));
  13. }, function (err) {
  14. sub.add(scheduler.schedule(function () { return subscriber.error(err); }));
  15. }); }));
  16. return sub;
  17. });
  18. }
  19. exports.schedulePromise = schedulePromise;
  20. //# sourceMappingURL=schedulePromise.js.map