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 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. "use strict";
  2. var __extends = (this && this.__extends) || (function () {
  3. var extendStatics = function (d, b) {
  4. extendStatics = Object.setPrototypeOf ||
  5. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  7. return extendStatics(d, b);
  8. }
  9. return function (d, b) {
  10. extendStatics(d, b);
  11. function __() { this.constructor = d; }
  12. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13. };
  14. })();
  15. Object.defineProperty(exports, "__esModule", { value: true });
  16. var Observable_1 = require("../Observable");
  17. var asap_1 = require("../scheduler/asap");
  18. var isNumeric_1 = require("../util/isNumeric");
  19. var SubscribeOnObservable = (function (_super) {
  20. __extends(SubscribeOnObservable, _super);
  21. function SubscribeOnObservable(source, delayTime, scheduler) {
  22. if (delayTime === void 0) { delayTime = 0; }
  23. if (scheduler === void 0) { scheduler = asap_1.asap; }
  24. var _this = _super.call(this) || this;
  25. _this.source = source;
  26. _this.delayTime = delayTime;
  27. _this.scheduler = scheduler;
  28. if (!isNumeric_1.isNumeric(delayTime) || delayTime < 0) {
  29. _this.delayTime = 0;
  30. }
  31. if (!scheduler || typeof scheduler.schedule !== 'function') {
  32. _this.scheduler = asap_1.asap;
  33. }
  34. return _this;
  35. }
  36. SubscribeOnObservable.create = function (source, delay, scheduler) {
  37. if (delay === void 0) { delay = 0; }
  38. if (scheduler === void 0) { scheduler = asap_1.asap; }
  39. return new SubscribeOnObservable(source, delay, scheduler);
  40. };
  41. SubscribeOnObservable.dispatch = function (arg) {
  42. var source = arg.source, subscriber = arg.subscriber;
  43. return this.add(source.subscribe(subscriber));
  44. };
  45. SubscribeOnObservable.prototype._subscribe = function (subscriber) {
  46. var delay = this.delayTime;
  47. var source = this.source;
  48. var scheduler = this.scheduler;
  49. return scheduler.schedule(SubscribeOnObservable.dispatch, delay, {
  50. source: source, subscriber: subscriber
  51. });
  52. };
  53. return SubscribeOnObservable;
  54. }(Observable_1.Observable));
  55. exports.SubscribeOnObservable = SubscribeOnObservable;
  56. //# sourceMappingURL=SubscribeOnObservable.js.map