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. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var Observable_1 = require("../Observable");
  4. var Subscription_1 = require("../Subscription");
  5. var subscribeToPromise_1 = require("../util/subscribeToPromise");
  6. function fromPromise(input, scheduler) {
  7. if (!scheduler) {
  8. return new Observable_1.Observable(subscribeToPromise_1.subscribeToPromise(input));
  9. }
  10. else {
  11. return new Observable_1.Observable(function (subscriber) {
  12. var sub = new Subscription_1.Subscription();
  13. sub.add(scheduler.schedule(function () { 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. return sub;
  22. });
  23. }
  24. }
  25. exports.fromPromise = fromPromise;
  26. //# sourceMappingURL=fromPromise.js.map