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.

fromArray.js 841B

1234567891011121314151617181920212223242526
  1. import { Observable } from '../Observable';
  2. import { Subscription } from '../Subscription';
  3. import { subscribeToArray } from '../util/subscribeToArray';
  4. export function fromArray(input, scheduler) {
  5. if (!scheduler) {
  6. return new Observable(subscribeToArray(input));
  7. }
  8. else {
  9. return new Observable(subscriber => {
  10. const sub = new Subscription();
  11. let i = 0;
  12. sub.add(scheduler.schedule(function () {
  13. if (i === input.length) {
  14. subscriber.complete();
  15. return;
  16. }
  17. subscriber.next(input[i++]);
  18. if (!subscriber.closed) {
  19. sub.add(this.schedule());
  20. }
  21. }));
  22. return sub;
  23. });
  24. }
  25. }
  26. //# sourceMappingURL=fromArray.js.map