subscribeOn.js 1.2KB

123456789101112131415161718192021222324252627282930313233
  1. /** PURE_IMPORTS_START .._observable_SubscribeOnObservable PURE_IMPORTS_END */
  2. import { SubscribeOnObservable } from '../observable/SubscribeOnObservable';
  3. /**
  4. * Asynchronously subscribes Observers to this Observable on the specified IScheduler.
  5. *
  6. * <img src="./img/subscribeOn.png" width="100%">
  7. *
  8. * @param {Scheduler} scheduler - The IScheduler to perform subscription actions on.
  9. * @return {Observable<T>} The source Observable modified so that its subscriptions happen on the specified IScheduler.
  10. .
  11. * @method subscribeOn
  12. * @owner Observable
  13. */
  14. export function subscribeOn(scheduler, delay) {
  15. if (delay === void 0) {
  16. delay = 0;
  17. }
  18. return function subscribeOnOperatorFunction(source) {
  19. return source.lift(new SubscribeOnOperator(scheduler, delay));
  20. };
  21. }
  22. var SubscribeOnOperator = /*@__PURE__*/ (/*@__PURE__*/ function () {
  23. function SubscribeOnOperator(scheduler, delay) {
  24. this.scheduler = scheduler;
  25. this.delay = delay;
  26. }
  27. SubscribeOnOperator.prototype.call = function (subscriber, source) {
  28. return new SubscribeOnObservable(source, this.delay, this.scheduler).subscribe(subscriber);
  29. };
  30. return SubscribeOnOperator;
  31. }());
  32. //# sourceMappingURL=subscribeOn.js.map