a zip code crypto-currency system good for red ONLY

SubscribeOnObservable.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { Observable } from '../Observable';
  2. import { asap } from '../scheduler/asap';
  3. import { isNumeric } from '../util/isNumeric';
  4. /**
  5. * We need this JSDoc comment for affecting ESDoc.
  6. * @extends {Ignored}
  7. * @hide true
  8. */
  9. export class SubscribeOnObservable extends Observable {
  10. constructor(source, delayTime = 0, scheduler = asap) {
  11. super();
  12. this.source = source;
  13. this.delayTime = delayTime;
  14. this.scheduler = scheduler;
  15. if (!isNumeric(delayTime) || delayTime < 0) {
  16. this.delayTime = 0;
  17. }
  18. if (!scheduler || typeof scheduler.schedule !== 'function') {
  19. this.scheduler = asap;
  20. }
  21. }
  22. static create(source, delay = 0, scheduler = asap) {
  23. return new SubscribeOnObservable(source, delay, scheduler);
  24. }
  25. static dispatch(arg) {
  26. const { source, subscriber } = arg;
  27. return this.add(source.subscribe(subscriber));
  28. }
  29. /** @deprecated internal use only */ _subscribe(subscriber) {
  30. const delay = this.delayTime;
  31. const source = this.source;
  32. const scheduler = this.scheduler;
  33. return scheduler.schedule(SubscribeOnObservable.dispatch, delay, {
  34. source, subscriber
  35. });
  36. }
  37. }
  38. //# sourceMappingURL=SubscribeOnObservable.js.map