schedulePromise.js 844 B

1234567891011121314151617181920
  1. /** PURE_IMPORTS_START _Observable,_Subscription PURE_IMPORTS_END */
  2. import { Observable } from '../Observable';
  3. import { Subscription } from '../Subscription';
  4. export function schedulePromise(input, scheduler) {
  5. return new Observable(function (subscriber) {
  6. var sub = new Subscription();
  7. sub.add(scheduler.schedule(function () {
  8. 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. }));
  17. return sub;
  18. });
  19. }
  20. //# sourceMappingURL=schedulePromise.js.map