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.

range.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var Observable_1 = require("../Observable");
  4. function range(start, count, scheduler) {
  5. if (start === void 0) { start = 0; }
  6. if (count === void 0) { count = 0; }
  7. return new Observable_1.Observable(function (subscriber) {
  8. var index = 0;
  9. var current = start;
  10. if (scheduler) {
  11. return scheduler.schedule(dispatch, 0, {
  12. index: index, count: count, start: start, subscriber: subscriber
  13. });
  14. }
  15. else {
  16. do {
  17. if (index++ >= count) {
  18. subscriber.complete();
  19. break;
  20. }
  21. subscriber.next(current++);
  22. if (subscriber.closed) {
  23. break;
  24. }
  25. } while (true);
  26. }
  27. return undefined;
  28. });
  29. }
  30. exports.range = range;
  31. function dispatch(state) {
  32. var start = state.start, index = state.index, count = state.count, subscriber = state.subscriber;
  33. if (index >= count) {
  34. subscriber.complete();
  35. return;
  36. }
  37. subscriber.next(start);
  38. if (subscriber.closed) {
  39. return;
  40. }
  41. state.index = index + 1;
  42. state.start = start + 1;
  43. this.schedule(state);
  44. }
  45. exports.dispatch = dispatch;
  46. //# sourceMappingURL=range.js.map