|
1234567891011121314151617181920212223242526 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Observable_1 = require("../Observable");
- var Subscription_1 = require("../Subscription");
- var subscribeToPromise_1 = require("../util/subscribeToPromise");
- function fromPromise(input, scheduler) {
- if (!scheduler) {
- return new Observable_1.Observable(subscribeToPromise_1.subscribeToPromise(input));
- }
- else {
- return new Observable_1.Observable(function (subscriber) {
- var sub = new Subscription_1.Subscription();
- sub.add(scheduler.schedule(function () { return input.then(function (value) {
- sub.add(scheduler.schedule(function () {
- subscriber.next(value);
- sub.add(scheduler.schedule(function () { return subscriber.complete(); }));
- }));
- }, function (err) {
- sub.add(scheduler.schedule(function () { return subscriber.error(err); }));
- }); }));
- return sub;
- });
- }
- }
- exports.fromPromise = fromPromise;
- //# sourceMappingURL=fromPromise.js.map
|