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

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