2022-01-21 08:28:41 +00:00
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2022-06-08 10:36:39 +00:00
|
|
|
exports.scheduleIterable = void 0;
|
2022-01-21 08:28:41 +00:00
|
|
|
var Observable_1 = require("../Observable");
|
|
|
|
var iterator_1 = require("../symbol/iterator");
|
2022-06-08 10:36:39 +00:00
|
|
|
var isFunction_1 = require("../util/isFunction");
|
|
|
|
var executeSchedule_1 = require("../util/executeSchedule");
|
2022-01-21 08:28:41 +00:00
|
|
|
function scheduleIterable(input, scheduler) {
|
|
|
|
return new Observable_1.Observable(function (subscriber) {
|
|
|
|
var iterator;
|
2022-06-08 10:36:39 +00:00
|
|
|
executeSchedule_1.executeSchedule(subscriber, scheduler, function () {
|
2022-01-21 08:28:41 +00:00
|
|
|
iterator = input[iterator_1.iterator]();
|
2022-06-08 10:36:39 +00:00
|
|
|
executeSchedule_1.executeSchedule(subscriber, scheduler, function () {
|
|
|
|
var _a;
|
2022-01-21 08:28:41 +00:00
|
|
|
var value;
|
|
|
|
var done;
|
|
|
|
try {
|
2022-06-08 10:36:39 +00:00
|
|
|
(_a = iterator.next(), value = _a.value, done = _a.done);
|
2022-01-21 08:28:41 +00:00
|
|
|
}
|
|
|
|
catch (err) {
|
|
|
|
subscriber.error(err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (done) {
|
|
|
|
subscriber.complete();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
subscriber.next(value);
|
|
|
|
}
|
2022-06-08 10:36:39 +00:00
|
|
|
}, 0, true);
|
|
|
|
});
|
|
|
|
return function () { return isFunction_1.isFunction(iterator === null || iterator === void 0 ? void 0 : iterator.return) && iterator.return(); };
|
2022-01-21 08:28:41 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
exports.scheduleIterable = scheduleIterable;
|
|
|
|
//# sourceMappingURL=scheduleIterable.js.map
|