61 lines
2.2 KiB
JavaScript
61 lines
2.2 KiB
JavaScript
/** PURE_IMPORTS_START .._Observable,.._scheduler_asap,.._util_isNumeric PURE_IMPORTS_END */
|
|
var __extends = (this && this.__extends) || function (d, b) {
|
|
for (var p in b)
|
|
if (b.hasOwnProperty(p))
|
|
d[p] = b[p];
|
|
function __() { this.constructor = d; }
|
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
};
|
|
import { Observable } from '../Observable';
|
|
import { asap } from '../scheduler/asap';
|
|
import { isNumeric } from '../util/isNumeric';
|
|
/**
|
|
* We need this JSDoc comment for affecting ESDoc.
|
|
* @extends {Ignored}
|
|
* @hide true
|
|
*/
|
|
export var SubscribeOnObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
|
|
__extends(SubscribeOnObservable, _super);
|
|
function SubscribeOnObservable(source, delayTime, scheduler) {
|
|
if (delayTime === void 0) {
|
|
delayTime = 0;
|
|
}
|
|
if (scheduler === void 0) {
|
|
scheduler = asap;
|
|
}
|
|
_super.call(this);
|
|
this.source = source;
|
|
this.delayTime = delayTime;
|
|
this.scheduler = scheduler;
|
|
if (!isNumeric(delayTime) || delayTime < 0) {
|
|
this.delayTime = 0;
|
|
}
|
|
if (!scheduler || typeof scheduler.schedule !== 'function') {
|
|
this.scheduler = asap;
|
|
}
|
|
}
|
|
SubscribeOnObservable.create = function (source, delay, scheduler) {
|
|
if (delay === void 0) {
|
|
delay = 0;
|
|
}
|
|
if (scheduler === void 0) {
|
|
scheduler = asap;
|
|
}
|
|
return new SubscribeOnObservable(source, delay, scheduler);
|
|
};
|
|
SubscribeOnObservable.dispatch = function (arg) {
|
|
var source = arg.source, subscriber = arg.subscriber;
|
|
return this.add(source.subscribe(subscriber));
|
|
};
|
|
/** @deprecated internal use only */ SubscribeOnObservable.prototype._subscribe = function (subscriber) {
|
|
var delay = this.delayTime;
|
|
var source = this.source;
|
|
var scheduler = this.scheduler;
|
|
return scheduler.schedule(SubscribeOnObservable.dispatch, delay, {
|
|
source: source, subscriber: subscriber
|
|
});
|
|
};
|
|
return SubscribeOnObservable;
|
|
}(Observable));
|
|
//# sourceMappingURL=SubscribeOnObservable.js.map
|