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.

fromPromise.js 1.1KB

1234567891011121314151617181920212223242526
  1. /** PURE_IMPORTS_START _Observable,_Subscription,_util_subscribeToPromise PURE_IMPORTS_END */
  2. import { Observable } from '../Observable';
  3. import { Subscription } from '../Subscription';
  4. import { subscribeToPromise } from '../util/subscribeToPromise';
  5. export function fromPromise(input, scheduler) {
  6. if (!scheduler) {
  7. return new Observable(subscribeToPromise(input));
  8. }
  9. else {
  10. return new Observable(function (subscriber) {
  11. var sub = new Subscription();
  12. sub.add(scheduler.schedule(function () {
  13. return input.then(function (value) {
  14. sub.add(scheduler.schedule(function () {
  15. subscriber.next(value);
  16. sub.add(scheduler.schedule(function () { return subscriber.complete(); }));
  17. }));
  18. }, function (err) {
  19. sub.add(scheduler.schedule(function () { return subscriber.error(err); }));
  20. });
  21. }));
  22. return sub;
  23. });
  24. }
  25. }
  26. //# sourceMappingURL=fromPromise.js.map