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

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