Last change
on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.5 KB
|
Line | |
---|
1 | /** PURE_IMPORTS_START tslib,_Subject,_util_ObjectUnsubscribedError PURE_IMPORTS_END */
|
---|
2 | import * as tslib_1 from "tslib";
|
---|
3 | import { Subject } from './Subject';
|
---|
4 | import { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError';
|
---|
5 | var BehaviorSubject = /*@__PURE__*/ (function (_super) {
|
---|
6 | tslib_1.__extends(BehaviorSubject, _super);
|
---|
7 | function BehaviorSubject(_value) {
|
---|
8 | var _this = _super.call(this) || this;
|
---|
9 | _this._value = _value;
|
---|
10 | return _this;
|
---|
11 | }
|
---|
12 | Object.defineProperty(BehaviorSubject.prototype, "value", {
|
---|
13 | get: function () {
|
---|
14 | return this.getValue();
|
---|
15 | },
|
---|
16 | enumerable: true,
|
---|
17 | configurable: true
|
---|
18 | });
|
---|
19 | BehaviorSubject.prototype._subscribe = function (subscriber) {
|
---|
20 | var subscription = _super.prototype._subscribe.call(this, subscriber);
|
---|
21 | if (subscription && !subscription.closed) {
|
---|
22 | subscriber.next(this._value);
|
---|
23 | }
|
---|
24 | return subscription;
|
---|
25 | };
|
---|
26 | BehaviorSubject.prototype.getValue = function () {
|
---|
27 | if (this.hasError) {
|
---|
28 | throw this.thrownError;
|
---|
29 | }
|
---|
30 | else if (this.closed) {
|
---|
31 | throw new ObjectUnsubscribedError();
|
---|
32 | }
|
---|
33 | else {
|
---|
34 | return this._value;
|
---|
35 | }
|
---|
36 | };
|
---|
37 | BehaviorSubject.prototype.next = function (value) {
|
---|
38 | _super.prototype.next.call(this, this._value = value);
|
---|
39 | };
|
---|
40 | return BehaviorSubject;
|
---|
41 | }(Subject));
|
---|
42 | export { BehaviorSubject };
|
---|
43 | //# sourceMappingURL=BehaviorSubject.js.map
|
---|
Note:
See
TracBrowser
for help on using the repository browser.