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 853B

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