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.
59 lines
1.9 KiB
59 lines
1.9 KiB
/** PURE_IMPORTS_START .._Observable 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'; |
|
/** |
|
* We need this JSDoc comment for affecting ESDoc. |
|
* @extends {Ignored} |
|
* @hide true |
|
*/ |
|
export var ScalarObservable = /*@__PURE__*/ (/*@__PURE__*/ 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)); |
|
//# sourceMappingURL=ScalarObservable.js.map
|
|
|