scheduleArray.js 771 B

1234567891011121314151617181920212223
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var Observable_1 = require("../Observable");
  4. var Subscription_1 = require("../Subscription");
  5. function scheduleArray(input, scheduler) {
  6. return new Observable_1.Observable(function (subscriber) {
  7. var sub = new Subscription_1.Subscription();
  8. var i = 0;
  9. sub.add(scheduler.schedule(function () {
  10. if (i === input.length) {
  11. subscriber.complete();
  12. return;
  13. }
  14. subscriber.next(input[i++]);
  15. if (!subscriber.closed) {
  16. sub.add(this.schedule());
  17. }
  18. }));
  19. return sub;
  20. });
  21. }
  22. exports.scheduleArray = scheduleArray;
  23. //# sourceMappingURL=scheduleArray.js.map