Subtheme of barrio
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.
 
 
 
 

58 lines
1.9 KiB

"use strict";
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 __());
};
var Observable_1 = require('../Observable');
/**
* We need this JSDoc comment for affecting ESDoc.
* @extends {Ignored}
* @hide true
*/
var ScalarObservable = (function (_super) {
__extends(ScalarObservable, _super);
function ScalarObservable(value, scheduler) {
_super.call(this);
this.value = value;
this.scheduler = scheduler;
this._isScalar = true;
if (scheduler) {
this._isScalar = false;
}
}
ScalarObservable.create = function (value, scheduler) {
return new ScalarObservable(value, scheduler);
};
ScalarObservable.dispatch = function (state) {
var done = state.done, value = state.value, subscriber = state.subscriber;
if (done) {
subscriber.complete();
return;
}
subscriber.next(value);
if (subscriber.closed) {
return;
}
state.done = true;
this.schedule(state);
};
/** @deprecated internal use only */ ScalarObservable.prototype._subscribe = function (subscriber) {
var value = this.value;
var scheduler = this.scheduler;
if (scheduler) {
return scheduler.schedule(ScalarObservable.dispatch, 0, {
done: false, value: value, subscriber: subscriber
});
}
else {
subscriber.next(value);
if (!subscriber.closed) {
subscriber.complete();
}
}
};
return ScalarObservable;
}(Observable_1.Observable));
exports.ScalarObservable = ScalarObservable;
//# sourceMappingURL=ScalarObservable.js.map