subscribeOn.js 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. "use strict";
  2. var SubscribeOnObservable_1 = require('../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. function subscribeOn(scheduler, delay) {
  15. if (delay === void 0) { delay = 0; }
  16. return function subscribeOnOperatorFunction(source) {
  17. return source.lift(new SubscribeOnOperator(scheduler, delay));
  18. };
  19. }
  20. exports.subscribeOn = subscribeOn;
  21. var SubscribeOnOperator = (function () {
  22. function SubscribeOnOperator(scheduler, delay) {
  23. this.scheduler = scheduler;
  24. this.delay = delay;
  25. }
  26. SubscribeOnOperator.prototype.call = function (subscriber, source) {
  27. return new SubscribeOnObservable_1.SubscribeOnObservable(source, this.delay, this.scheduler).subscribe(subscriber);
  28. };
  29. return SubscribeOnOperator;
  30. }());
  31. //# sourceMappingURL=subscribeOn.js.map