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.

SubscribeOnObservable.js 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /** PURE_IMPORTS_START tslib,_Observable,_scheduler_asap,_util_isNumeric PURE_IMPORTS_END */
  2. import * as tslib_1 from "tslib";
  3. import { Observable } from '../Observable';
  4. import { asap } from '../scheduler/asap';
  5. import { isNumeric } from '../util/isNumeric';
  6. var SubscribeOnObservable = /*@__PURE__*/ (function (_super) {
  7. tslib_1.__extends(SubscribeOnObservable, _super);
  8. function SubscribeOnObservable(source, delayTime, scheduler) {
  9. if (delayTime === void 0) {
  10. delayTime = 0;
  11. }
  12. if (scheduler === void 0) {
  13. scheduler = asap;
  14. }
  15. var _this = _super.call(this) || this;
  16. _this.source = source;
  17. _this.delayTime = delayTime;
  18. _this.scheduler = scheduler;
  19. if (!isNumeric(delayTime) || delayTime < 0) {
  20. _this.delayTime = 0;
  21. }
  22. if (!scheduler || typeof scheduler.schedule !== 'function') {
  23. _this.scheduler = asap;
  24. }
  25. return _this;
  26. }
  27. SubscribeOnObservable.create = function (source, delay, scheduler) {
  28. if (delay === void 0) {
  29. delay = 0;
  30. }
  31. if (scheduler === void 0) {
  32. scheduler = asap;
  33. }
  34. return new SubscribeOnObservable(source, delay, scheduler);
  35. };
  36. SubscribeOnObservable.dispatch = function (arg) {
  37. var source = arg.source, subscriber = arg.subscriber;
  38. return this.add(source.subscribe(subscriber));
  39. };
  40. SubscribeOnObservable.prototype._subscribe = function (subscriber) {
  41. var delay = this.delayTime;
  42. var source = this.source;
  43. var scheduler = this.scheduler;
  44. return scheduler.schedule(SubscribeOnObservable.dispatch, delay, {
  45. source: source, subscriber: subscriber
  46. });
  47. };
  48. return SubscribeOnObservable;
  49. }(Observable));
  50. export { SubscribeOnObservable };
  51. //# sourceMappingURL=SubscribeOnObservable.js.map