@fncts/observable 0.0.9 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BehaviorSubject.d.ts +2 -2
- package/Notification.d.ts +4 -4
- package/Observable/api/connect.d.ts +2 -2
- package/Observable/api/connectable.d.ts +2 -2
- package/Observable/api/fromEvent.d.ts +4 -0
- package/Observable/api/race.d.ts +2 -1
- package/Observable/api/raceWith.d.ts +2 -2
- package/Observable/api/repeatWhen.d.ts +5 -2
- package/Observable/api/retryWhen.d.ts +2 -3
- package/Observable/api/share.d.ts +5 -4
- package/Observable/api/window.d.ts +2 -2
- package/Observable/api/windowCount.d.ts +2 -2
- package/Observable/api/windowTime.d.ts +5 -5
- package/Observable/api/windowToggle.d.ts +3 -3
- package/Observable/api/windowWhen.d.ts +3 -3
- package/Observable/api.d.ts +189 -195
- package/Observable/definition.d.ts +8 -6
- package/ObservableRef/api.d.ts +63 -0
- package/ObservableRef/atomic.d.ts +32 -0
- package/ObservableRef/definition.d.ts +52 -0
- package/Operator.d.ts +2 -2
- package/_cjs/Action.cjs +0 -7
- package/_cjs/Action.cjs.map +1 -1
- package/_cjs/AnimationFrameAction.cjs +0 -12
- package/_cjs/AnimationFrameAction.cjs.map +1 -1
- package/_cjs/AnimationFrameScheduler.cjs +0 -12
- package/_cjs/AnimationFrameScheduler.cjs.map +1 -1
- package/_cjs/AsyncAction.cjs +0 -25
- package/_cjs/AsyncAction.cjs.map +1 -1
- package/_cjs/AsyncScheduler.cjs +2 -16
- package/_cjs/AsyncScheduler.cjs.map +1 -1
- package/_cjs/BehaviorSubject.cjs +1 -13
- package/_cjs/BehaviorSubject.cjs.map +1 -1
- package/_cjs/Notification.cjs +21 -40
- package/_cjs/Notification.cjs.map +1 -1
- package/_cjs/Observable/api/connect.cjs +12 -17
- package/_cjs/Observable/api/connect.cjs.map +1 -1
- package/_cjs/Observable/api/connectable.cjs +6 -18
- package/_cjs/Observable/api/connectable.cjs.map +1 -1
- package/_cjs/Observable/api/fromCallback.cjs +0 -15
- package/_cjs/Observable/api/fromCallback.cjs.map +1 -1
- package/_cjs/Observable/api/fromEvent.cjs +3 -5
- package/_cjs/Observable/api/fromEvent.cjs.map +1 -1
- package/_cjs/Observable/api/index.cjs +0 -28
- package/_cjs/Observable/api/index.cjs.map +1 -1
- package/_cjs/Observable/api/race.cjs +2 -12
- package/_cjs/Observable/api/race.cjs.map +1 -1
- package/_cjs/Observable/api/raceWith.cjs +8 -11
- package/_cjs/Observable/api/raceWith.cjs.map +1 -1
- package/_cjs/Observable/api/repeatWhen.cjs +44 -55
- package/_cjs/Observable/api/repeatWhen.cjs.map +1 -1
- package/_cjs/Observable/api/retryWhen.cjs +29 -45
- package/_cjs/Observable/api/retryWhen.cjs.map +1 -1
- package/_cjs/Observable/api/share.cjs +61 -77
- package/_cjs/Observable/api/share.cjs.map +1 -1
- package/_cjs/Observable/api/window.cjs +33 -39
- package/_cjs/Observable/api/window.cjs.map +1 -1
- package/_cjs/Observable/api/windowCount.cjs +40 -48
- package/_cjs/Observable/api/windowCount.cjs.map +1 -1
- package/_cjs/Observable/api/windowTime.cjs +60 -73
- package/_cjs/Observable/api/windowTime.cjs.map +1 -1
- package/_cjs/Observable/api/windowToggle.cjs +55 -71
- package/_cjs/Observable/api/windowToggle.cjs.map +1 -1
- package/_cjs/Observable/api/windowWhen.cjs +42 -52
- package/_cjs/Observable/api/windowWhen.cjs.map +1 -1
- package/_cjs/Observable/api.cjs +1260 -1485
- package/_cjs/Observable/api.cjs.map +1 -1
- package/_cjs/Observable/definition.cjs +9 -37
- package/_cjs/Observable/definition.cjs.map +1 -1
- package/_cjs/Observable/dom/animationFrames.cjs +0 -12
- package/_cjs/Observable/dom/animationFrames.cjs.map +1 -1
- package/_cjs/Observable.cjs +0 -38
- package/_cjs/Observable.cjs.map +1 -1
- package/_cjs/ObservableRef/api.cjs +160 -0
- package/_cjs/ObservableRef/api.cjs.map +1 -0
- package/_cjs/ObservableRef/atomic.cjs +93 -0
- package/_cjs/ObservableRef/atomic.cjs.map +1 -0
- package/_cjs/ObservableRef/definition.cjs +24 -0
- package/_cjs/ObservableRef/definition.cjs.map +1 -0
- package/_cjs/Operator.cjs +11 -21
- package/_cjs/Operator.cjs.map +1 -1
- package/_cjs/Scheduler.cjs +0 -18
- package/_cjs/Scheduler.cjs.map +1 -1
- package/_cjs/Subject.cjs +3 -50
- package/_cjs/Subject.cjs.map +1 -1
- package/_cjs/Subscriber.cjs +0 -32
- package/_cjs/Subscriber.cjs.map +1 -1
- package/_cjs/Subscription.cjs +0 -37
- package/_cjs/Subscription.cjs.map +1 -1
- package/_cjs/index.cjs +0 -28
- package/_cjs/internal/animationFrameProvider.cjs +0 -9
- package/_cjs/internal/animationFrameProvider.cjs.map +1 -1
- package/_cjs/internal/args.cjs +0 -6
- package/_cjs/internal/args.cjs.map +1 -1
- package/_cjs/internal/intervalProvider.cjs +0 -2
- package/_cjs/internal/intervalProvider.cjs.map +1 -1
- package/_cjs/internal/performanceTimestampProvider.cjs +0 -1
- package/_cjs/internal/performanceTimestampProvider.cjs.map +1 -1
- package/_cjs/internal/timeoutProvider.cjs +0 -2
- package/_cjs/internal/timeoutProvider.cjs.map +1 -1
- package/_cjs/internal/timestampProvider.cjs +0 -1
- package/_cjs/internal/timestampProvider.cjs.map +1 -1
- package/_cjs/internal/util.cjs +2 -21
- package/_cjs/internal/util.cjs.map +1 -1
- package/_mjs/Action.mjs +0 -3
- package/_mjs/Action.mjs.map +1 -1
- package/_mjs/AnimationFrameAction.mjs +0 -6
- package/_mjs/AnimationFrameAction.mjs.map +1 -1
- package/_mjs/AnimationFrameScheduler.mjs +0 -7
- package/_mjs/AnimationFrameScheduler.mjs.map +1 -1
- package/_mjs/AsyncAction.mjs +0 -17
- package/_mjs/AsyncAction.mjs.map +1 -1
- package/_mjs/AsyncScheduler.mjs +2 -10
- package/_mjs/AsyncScheduler.mjs.map +1 -1
- package/_mjs/BehaviorSubject.mjs +1 -8
- package/_mjs/BehaviorSubject.mjs.map +1 -1
- package/_mjs/Notification.mjs +18 -26
- package/_mjs/Notification.mjs.map +1 -1
- package/_mjs/Observable/api/connect.mjs +12 -11
- package/_mjs/Observable/api/connect.mjs.map +1 -1
- package/_mjs/Observable/api/connectable.mjs +6 -9
- package/_mjs/Observable/api/connectable.mjs.map +1 -1
- package/_mjs/Observable/api/fromCallback.mjs +0 -10
- package/_mjs/Observable/api/fromCallback.mjs.map +1 -1
- package/_mjs/Observable/api/fromEvent.mjs +3 -1
- package/_mjs/Observable/api/fromEvent.mjs.map +1 -1
- package/_mjs/Observable/api/index.mjs.map +1 -1
- package/_mjs/Observable/api/race.mjs +2 -6
- package/_mjs/Observable/api/race.mjs.map +1 -1
- package/_mjs/Observable/api/raceWith.mjs +7 -6
- package/_mjs/Observable/api/raceWith.mjs.map +1 -1
- package/_mjs/Observable/api/repeatWhen.mjs +44 -48
- package/_mjs/Observable/api/repeatWhen.mjs.map +1 -1
- package/_mjs/Observable/api/retryWhen.mjs +29 -37
- package/_mjs/Observable/api/retryWhen.mjs.map +1 -1
- package/_mjs/Observable/api/share.mjs +60 -70
- package/_mjs/Observable/api/share.mjs.map +1 -1
- package/_mjs/Observable/api/window.mjs +32 -33
- package/_mjs/Observable/api/window.mjs.map +1 -1
- package/_mjs/Observable/api/windowCount.mjs +39 -43
- package/_mjs/Observable/api/windowCount.mjs.map +1 -1
- package/_mjs/Observable/api/windowTime.mjs +59 -63
- package/_mjs/Observable/api/windowTime.mjs.map +1 -1
- package/_mjs/Observable/api/windowToggle.mjs +54 -62
- package/_mjs/Observable/api/windowToggle.mjs.map +1 -1
- package/_mjs/Observable/api/windowWhen.mjs +41 -45
- package/_mjs/Observable/api/windowWhen.mjs.map +1 -1
- package/_mjs/Observable/api.mjs +1186 -1311
- package/_mjs/Observable/api.mjs.map +1 -1
- package/_mjs/Observable/definition.mjs +9 -24
- package/_mjs/Observable/definition.mjs.map +1 -1
- package/_mjs/Observable/dom/animationFrames.mjs +0 -5
- package/_mjs/Observable/dom/animationFrames.mjs.map +1 -1
- package/_mjs/Observable.mjs +4 -4
- package/_mjs/Observable.mjs.map +1 -1
- package/_mjs/ObservableRef/api.mjs +141 -0
- package/_mjs/ObservableRef/api.mjs.map +1 -0
- package/_mjs/ObservableRef/atomic.mjs +82 -0
- package/_mjs/ObservableRef/atomic.mjs.map +1 -0
- package/_mjs/ObservableRef/definition.mjs +16 -0
- package/_mjs/ObservableRef/definition.mjs.map +1 -0
- package/_mjs/Operator.mjs +11 -12
- package/_mjs/Operator.mjs.map +1 -1
- package/_mjs/Scheduler.mjs +0 -9
- package/_mjs/Scheduler.mjs.map +1 -1
- package/_mjs/Subject.mjs +3 -37
- package/_mjs/Subject.mjs.map +1 -1
- package/_mjs/Subscriber.mjs +0 -20
- package/_mjs/Subscriber.mjs.map +1 -1
- package/_mjs/Subscription.mjs +0 -26
- package/_mjs/Subscription.mjs.map +1 -1
- package/_mjs/index.mjs.map +1 -1
- package/_mjs/internal/animationFrameProvider.mjs +0 -5
- package/_mjs/internal/animationFrameProvider.mjs.map +1 -1
- package/_mjs/internal/args.mjs +0 -2
- package/_mjs/internal/args.mjs.map +1 -1
- package/_mjs/internal/intervalProvider.mjs +0 -2
- package/_mjs/internal/intervalProvider.mjs.map +1 -1
- package/_mjs/internal/performanceTimestampProvider.mjs +0 -1
- package/_mjs/internal/performanceTimestampProvider.mjs.map +1 -1
- package/_mjs/internal/timeoutProvider.mjs +0 -2
- package/_mjs/internal/timeoutProvider.mjs.map +1 -1
- package/_mjs/internal/timestampProvider.mjs +0 -1
- package/_mjs/internal/timestampProvider.mjs.map +1 -1
- package/_mjs/internal/util.mjs +2 -7
- package/_mjs/internal/util.mjs.map +1 -1
- package/_src/Action.ts +0 -1
- package/_src/AnimationFrameAction.ts +0 -2
- package/_src/AnimationFrameScheduler.ts +2 -7
- package/_src/BehaviorSubject.ts +3 -3
- package/_src/Notification.ts +21 -23
- package/_src/Observable/api/connect.ts +12 -9
- package/_src/Observable/api/connectable.ts +6 -7
- package/_src/Observable/api/fromCallback.ts +0 -1
- package/_src/Observable/api/fromEvent.ts +3 -0
- package/_src/Observable/api/race.ts +15 -13
- package/_src/Observable/api/raceWith.ts +15 -14
- package/_src/Observable/api/repeatWhen.ts +51 -56
- package/_src/Observable/api/retryWhen.ts +38 -43
- package/_src/Observable/api/share.ts +63 -71
- package/_src/Observable/api/window.ts +36 -41
- package/_src/Observable/api/windowCount.ts +44 -51
- package/_src/Observable/api/windowTime.ts +69 -81
- package/_src/Observable/api/windowToggle.ts +69 -73
- package/_src/Observable/api/windowWhen.ts +49 -55
- package/_src/Observable/api.ts +1493 -1498
- package/_src/Observable/definition.ts +24 -18
- package/_src/Observable/dom/animationFrames.ts +16 -6
- package/_src/Observable/instances.ts +0 -23
- package/_src/Observable.ts +0 -2
- package/_src/ObservableRef/api.ts +169 -0
- package/_src/ObservableRef/atomic.ts +85 -0
- package/_src/ObservableRef/definition.ts +57 -0
- package/_src/Operator.ts +20 -15
- package/_src/Scheduler.ts +0 -6
- package/_src/Subject.ts +1 -1
- package/_src/Subscriber.ts +3 -2
- package/_src/global.ts +5 -1
- package/_src/internal/util.ts +8 -4
- package/global.d.ts +5 -1
- package/package.json +2 -2
package/_cjs/Subject.cjs
CHANGED
|
@@ -4,21 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Subject = exports.AsyncSubject = exports.AnonymousSubject = void 0;
|
|
7
|
-
|
|
8
7
|
var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/observable/Observable"));
|
|
9
|
-
|
|
10
8
|
var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/observable/Subscription"));
|
|
11
|
-
|
|
12
9
|
var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Either/destructors"));
|
|
13
|
-
|
|
14
10
|
var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Either/constructors"));
|
|
15
|
-
|
|
16
11
|
var _util = /*#__PURE__*/require("@fncts/observable/internal/util");
|
|
17
|
-
|
|
18
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
-
|
|
20
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
22
14
|
class Subject extends tsplus_module_1.Observable {
|
|
23
15
|
constructor() {
|
|
24
16
|
super();
|
|
@@ -28,82 +20,66 @@ class Subject extends tsplus_module_1.Observable {
|
|
|
28
20
|
this.hasError = false;
|
|
29
21
|
this.thrownError = null;
|
|
30
22
|
}
|
|
31
|
-
|
|
32
23
|
lift(operator) {
|
|
33
24
|
const subject = new AnonymousSubject(this, this);
|
|
34
25
|
subject.operator = operator;
|
|
35
26
|
return subject;
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
next(value) {
|
|
39
29
|
this.throwIfClosed();
|
|
40
|
-
|
|
41
30
|
if (!this.isStopped) {
|
|
42
31
|
const copy = this.observers.slice();
|
|
43
|
-
|
|
44
32
|
for (const observer of copy) {
|
|
45
33
|
observer.next(value);
|
|
46
34
|
}
|
|
47
35
|
}
|
|
48
36
|
}
|
|
49
|
-
|
|
50
37
|
error(err) {
|
|
51
38
|
this.throwIfClosed();
|
|
52
|
-
|
|
53
39
|
if (!this.isStopped) {
|
|
54
40
|
this.hasError = this.isStopped = true;
|
|
55
41
|
this.thrownError = err;
|
|
56
42
|
const {
|
|
57
43
|
observers
|
|
58
44
|
} = this;
|
|
59
|
-
|
|
60
45
|
while (observers.length) {
|
|
61
46
|
observers.shift().error(err);
|
|
62
47
|
}
|
|
63
48
|
}
|
|
64
49
|
}
|
|
65
|
-
|
|
66
50
|
complete() {
|
|
67
51
|
this.throwIfClosed();
|
|
68
|
-
|
|
69
52
|
if (!this.isStopped) {
|
|
70
53
|
this.isStopped = true;
|
|
71
54
|
const {
|
|
72
55
|
observers
|
|
73
56
|
} = this;
|
|
74
|
-
|
|
75
57
|
while (observers.length) {
|
|
76
58
|
observers.shift().complete();
|
|
77
59
|
}
|
|
78
60
|
}
|
|
79
61
|
}
|
|
80
|
-
|
|
81
62
|
unsubscribe() {
|
|
82
63
|
this.isStopped = this.closed = true;
|
|
83
64
|
this.observers = null;
|
|
84
65
|
}
|
|
85
|
-
|
|
86
66
|
get observed() {
|
|
87
67
|
return this.observers?.length > 0;
|
|
88
68
|
}
|
|
89
|
-
|
|
90
69
|
throwIfClosed() {
|
|
91
70
|
if (this.closed) {
|
|
92
71
|
throw new Error("Object Unsubscribed");
|
|
93
72
|
}
|
|
94
73
|
}
|
|
95
|
-
|
|
96
74
|
trySubscribe(subscriber, environment) {
|
|
97
75
|
this.throwIfClosed();
|
|
98
76
|
return super.trySubscribe(subscriber, environment);
|
|
99
77
|
}
|
|
100
|
-
|
|
101
78
|
subscribeInternal(subscriber) {
|
|
102
79
|
this.throwIfClosed();
|
|
103
80
|
this.checkFinalizedStatuses(subscriber);
|
|
104
81
|
return this.innerSubscribe(subscriber);
|
|
105
82
|
}
|
|
106
|
-
|
|
107
83
|
innerSubscribe(subscriber) {
|
|
108
84
|
const {
|
|
109
85
|
hasError,
|
|
@@ -112,60 +88,46 @@ class Subject extends tsplus_module_1.Observable {
|
|
|
112
88
|
} = this;
|
|
113
89
|
return hasError || isStopped ? tsplus_module_2.EMPTY_SUBSCRIPTION : (observers.push(subscriber), new tsplus_module_2.Subscription(() => (0, _util.arrayRemove)(observers, subscriber)));
|
|
114
90
|
}
|
|
115
|
-
|
|
116
91
|
checkFinalizedStatuses(subscriber) {
|
|
117
92
|
const {
|
|
118
93
|
hasError,
|
|
119
94
|
thrownError,
|
|
120
95
|
isStopped
|
|
121
96
|
} = this;
|
|
122
|
-
|
|
123
97
|
if (hasError) {
|
|
124
98
|
subscriber.error(thrownError);
|
|
125
99
|
} else if (isStopped) {
|
|
126
100
|
subscriber.complete();
|
|
127
101
|
}
|
|
128
102
|
}
|
|
129
|
-
|
|
130
103
|
asObservable() {
|
|
131
104
|
const observable = new tsplus_module_1.Observable();
|
|
132
105
|
observable.source = this;
|
|
133
106
|
return observable;
|
|
134
107
|
}
|
|
135
|
-
|
|
136
108
|
}
|
|
137
|
-
|
|
138
109
|
exports.Subject = Subject;
|
|
139
|
-
|
|
140
110
|
class AnonymousSubject extends Subject {
|
|
141
111
|
constructor(destination, source) {
|
|
142
112
|
super();
|
|
143
113
|
this.destination = destination;
|
|
144
114
|
this.source = source;
|
|
145
115
|
}
|
|
146
|
-
|
|
147
116
|
next(value) {
|
|
148
117
|
this.destination?.next?.(value);
|
|
149
118
|
}
|
|
150
|
-
|
|
151
119
|
error(err) {
|
|
152
120
|
this.destination?.error?.(err);
|
|
153
121
|
}
|
|
154
|
-
|
|
155
122
|
complete() {
|
|
156
123
|
this.destination?.complete?.();
|
|
157
124
|
}
|
|
158
125
|
/** @internal */
|
|
159
|
-
|
|
160
|
-
|
|
161
126
|
subscribeInternal(subscriber) {
|
|
162
|
-
return this.source?.subscribe(subscriber) ?? tsplus_module_2.EMPTY_SUBSCRIPTION;
|
|
127
|
+
return this.source?.provideEnvironment(this.environment).subscribe(subscriber) ?? tsplus_module_2.EMPTY_SUBSCRIPTION;
|
|
163
128
|
}
|
|
164
|
-
|
|
165
129
|
}
|
|
166
|
-
|
|
167
130
|
exports.AnonymousSubject = AnonymousSubject;
|
|
168
|
-
|
|
169
131
|
class AsyncSubject extends Subject {
|
|
170
132
|
constructor() {
|
|
171
133
|
super(...arguments);
|
|
@@ -174,8 +136,6 @@ class AsyncSubject extends Subject {
|
|
|
174
136
|
this.isComplete = false;
|
|
175
137
|
}
|
|
176
138
|
/** @internal */
|
|
177
|
-
|
|
178
|
-
|
|
179
139
|
checkFinalizedStatuses(subscriber) {
|
|
180
140
|
const {
|
|
181
141
|
hasError,
|
|
@@ -185,44 +145,37 @@ class AsyncSubject extends Subject {
|
|
|
185
145
|
isStopped,
|
|
186
146
|
isComplete
|
|
187
147
|
} = this;
|
|
188
|
-
|
|
189
148
|
if (hasError) {
|
|
190
149
|
subscriber.error(thrownError);
|
|
191
150
|
} else if (isStopped || isComplete) {
|
|
192
|
-
hasValue && tsplus_module_3.
|
|
151
|
+
hasValue && tsplus_module_3.match(e => subscriber.error(e), a => subscriber.next(a))(value);
|
|
193
152
|
subscriber.complete();
|
|
194
153
|
}
|
|
195
154
|
}
|
|
196
|
-
|
|
197
155
|
next(value) {
|
|
198
156
|
if (!this.isStopped) {
|
|
199
157
|
this.value = tsplus_module_4.right(value);
|
|
200
158
|
this.hasValue = true;
|
|
201
159
|
}
|
|
202
160
|
}
|
|
203
|
-
|
|
204
161
|
error(err) {
|
|
205
162
|
if (!this.isStopped) {
|
|
206
163
|
this.value = tsplus_module_4.left(err);
|
|
207
164
|
this.hasValue = true;
|
|
208
165
|
}
|
|
209
166
|
}
|
|
210
|
-
|
|
211
167
|
complete() {
|
|
212
168
|
const {
|
|
213
169
|
hasValue,
|
|
214
170
|
value,
|
|
215
171
|
isComplete
|
|
216
172
|
} = this;
|
|
217
|
-
|
|
218
173
|
if (!isComplete) {
|
|
219
174
|
this.isComplete = true;
|
|
220
|
-
hasValue && tsplus_module_3.
|
|
175
|
+
hasValue && tsplus_module_3.match(e => super.error(e), a => super.next(a))(value);
|
|
221
176
|
super.complete();
|
|
222
177
|
}
|
|
223
178
|
}
|
|
224
|
-
|
|
225
179
|
}
|
|
226
|
-
|
|
227
180
|
exports.AsyncSubject = AsyncSubject;
|
|
228
181
|
//# sourceMappingURL=Subject.cjs.map
|
package/_cjs/Subject.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Subject.cjs","mappings":"
|
|
1
|
+
{"version":3,"file":"Subject.cjs","mappings":";;;;;;;;;;AAAA;AAA8D;AAAA;AAIxD,MAAOA,OAAiB,SAAQC,0BAAmB;EAOvDC;IACE,KAAK,EAAE;IAPT,WAAM,GAAG,KAAK;IACJ,cAAS,GAA0B,EAAE;IACrC,cAAS,GAAe,KAAK;IAC7B,aAAQ,GAAgB,KAAK;IAC7B,gBAAW,GAAa,IAAK;EAIvC;EAEAC,IAAI,CAAYC,QAAyB;IACvC,MAAMC,OAAO,GAAM,IAAIC,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC;IACnDD,OAAO,CAACD,QAAQ,GAAGA,QAAe;IAClC,OAAOC,OAAc;EACvB;EAEAE,IAAI,CAACC,KAAQ;IACX,IAAI,CAACC,aAAa,EAAE;IACpB,IAAI,CAAC,IAAI,CAACC,SAAS,EAAE;MACnB,MAAMC,IAAI,GAAG,IAAI,CAACC,SAAS,CAACC,KAAK,EAAE;MACnC,KAAK,MAAMC,QAAQ,IAAIH,IAAI,EAAE;QAC3BG,QAAQ,CAACP,IAAI,CAACC,KAAK,CAAC;;;EAG1B;EAEAO,KAAK,CAACC,GAAa;IACjB,IAAI,CAACP,aAAa,EAAE;IACpB,IAAI,CAAC,IAAI,CAACC,SAAS,EAAE;MACnB,IAAI,CAACO,QAAQ,GAAS,IAAI,CAACP,SAAS,GAAG,IAAI;MAC3C,IA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V,QAAQ;MAAE0B,QAAQ;MAAEnC,KAAK;MAAEU,WAAW;MAAER,SAAS;MAAEkC;IAAU,CAAE,GAAG,IAAI;IAC9E,IAAI3B,QAAQ,EAAE;MACZU,UAAU,CAACZ,KAAK,CAACG,WAAW,CAAC;KAC9B,MAAM,IAAIR,SAAS,IAAIkC,UAAU,EAAE;MAClCD,QAAQ,IACNE,sBACGC,CAAC,IAAKnB,UAAU,CAACZ,KAAK,CAAC+B,CAAC,CAAC,EACzBC,CAAC,IAAKpB,UAAU,CAACpB,IAAI,CAACwC,CAAC,CAAC,EAF3BvC,KAAM,CAGL;MACHmB,UAAU,CAACN,QAAQ,EAAE;;EAEzB;EAEAd,IAAI,CAACC,KAAQ;IACX,IAAI,CAAC,IAAI,CAACE,SAAS,EAAE;MACnB,IAAI,CAACF,KAAK,GAAMwC,sBAAaxC,KAAK,CAAC;MACnC,IAAI,CAACmC,QAAQ,GAAG,IAAI;;EAExB;EAEA5B,KAAK,CAACC,GAAa;IACjB,IAAI,CAAC,IAAI,CAACN,SAAS,EAAE;MACnB,IAAI,CAACF,KAAK,GAAMwC,qBAAYhC,GAAG,CAAC;MAChC,IAAI,CAAC2B,QAAQ,GAAG,IAAI;;EAExB;EAEAtB,QAAQ;IACN,MAAM;MAAEsB,QAAQ;MAAEnC,KAAK;MAAEoC;IAAU,CAAE,GAAG,IAAI;IAC5C,IAAI,CAACA,UAAU,EAAE;MACf,IAAI,CAACA,UAAU,GAAG,IAAI;MACtBD,QAAQ,IACNE,sBACGC,CAAC,IAAK,KAAK,CAAC/B,KAAK,CAAC+B,CAAC,CAAC,EACpBC,CAAC,IAAK,KAAK,CAACxC,IAAI,CAACwC,CAAC,CAAC,EAFtBvC,KAAM,CAGL;MACH,KAAK,CAACa,QAAQ,EAAE;;EAEpB;;AACD","names":["Subject","tsplus_module_1","constructor","lift","operator","subject","AnonymousSubject","next","value","throwIfClosed","isStopped","copy","observers","slice","observer","error","err","hasError","thrownError","length","shift","complete","unsubscribe","closed","observed","Error","trySubscribe","subscriber","environment","subscribeInternal","checkFinalizedStatuses","innerSubscribe","tsplus_module_2","push","Subscription","asObservable","observable","Observable","source","destination","provideEnvironment","subscribe","AsyncSubject","hasValue","isComplete","tsplus_module_3","e","a","tsplus_module_4"],"sourceRoot":"","sources":["../_src/Subject.ts"],"sourcesContent":[null]}
|
package/_cjs/Subscriber.cjs
CHANGED
|
@@ -5,33 +5,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.SubscriberTypeId = exports.Subscriber = exports.SafeSubscriber = exports.EMPTY_OBSERVER = void 0;
|
|
7
7
|
exports.isSubscriber = isSubscriber;
|
|
8
|
-
|
|
9
8
|
var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/observable/Subscription"));
|
|
10
|
-
|
|
11
9
|
var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/util/predicates"));
|
|
12
|
-
|
|
13
10
|
var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/observable/internal/util"));
|
|
14
|
-
|
|
15
11
|
var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Cause/api"));
|
|
16
|
-
|
|
17
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
18
|
-
|
|
19
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
|
-
|
|
21
14
|
var _a;
|
|
22
|
-
|
|
23
15
|
const SubscriberTypeId = /*#__PURE__*/Symbol.for("fncts.observable.Subscriber");
|
|
24
16
|
exports.SubscriberTypeId = SubscriberTypeId;
|
|
25
|
-
|
|
26
17
|
class Subscriber extends tsplus_module_1.Subscription {
|
|
27
18
|
constructor(observer) {
|
|
28
19
|
super();
|
|
29
20
|
this[_a] = SubscriberTypeId;
|
|
30
21
|
this.isStopped = false;
|
|
31
|
-
|
|
32
22
|
if (observer) {
|
|
33
23
|
this.observer = observer;
|
|
34
|
-
|
|
35
24
|
if (tsplus_module_1.isSubscription(observer)) {
|
|
36
25
|
observer.add(this);
|
|
37
26
|
}
|
|
@@ -39,29 +28,23 @@ class Subscriber extends tsplus_module_1.Subscription {
|
|
|
39
28
|
this.observer = EMPTY_OBSERVER;
|
|
40
29
|
}
|
|
41
30
|
}
|
|
42
|
-
|
|
43
31
|
next(value) {
|
|
44
32
|
if (!this.isStopped) {
|
|
45
33
|
this._next(value);
|
|
46
34
|
}
|
|
47
35
|
}
|
|
48
|
-
|
|
49
36
|
error(err) {
|
|
50
37
|
if (!this.isStopped) {
|
|
51
38
|
this.isStopped = true;
|
|
52
|
-
|
|
53
39
|
this._error(err);
|
|
54
40
|
}
|
|
55
41
|
}
|
|
56
|
-
|
|
57
42
|
complete() {
|
|
58
43
|
if (!this.isStopped) {
|
|
59
44
|
this.isStopped = true;
|
|
60
|
-
|
|
61
45
|
this._complete();
|
|
62
46
|
}
|
|
63
47
|
}
|
|
64
|
-
|
|
65
48
|
unsubscribe() {
|
|
66
49
|
if (!this.closed) {
|
|
67
50
|
this.isStopped = true;
|
|
@@ -69,11 +52,9 @@ class Subscriber extends tsplus_module_1.Subscription {
|
|
|
69
52
|
this.observer = null;
|
|
70
53
|
}
|
|
71
54
|
}
|
|
72
|
-
|
|
73
55
|
_next(value) {
|
|
74
56
|
this.observer.next(value);
|
|
75
57
|
}
|
|
76
|
-
|
|
77
58
|
_error(err) {
|
|
78
59
|
try {
|
|
79
60
|
this.observer.error(err);
|
|
@@ -81,7 +62,6 @@ class Subscriber extends tsplus_module_1.Subscription {
|
|
|
81
62
|
this.unsubscribe();
|
|
82
63
|
}
|
|
83
64
|
}
|
|
84
|
-
|
|
85
65
|
_complete() {
|
|
86
66
|
try {
|
|
87
67
|
this.observer.complete();
|
|
@@ -89,19 +69,15 @@ class Subscriber extends tsplus_module_1.Subscription {
|
|
|
89
69
|
this.unsubscribe();
|
|
90
70
|
}
|
|
91
71
|
}
|
|
92
|
-
|
|
93
72
|
}
|
|
94
|
-
|
|
95
73
|
exports.Subscriber = Subscriber;
|
|
96
74
|
_a = SubscriberTypeId;
|
|
97
|
-
|
|
98
75
|
class SafeSubscriber extends Subscriber {
|
|
99
76
|
constructor(observer) {
|
|
100
77
|
super();
|
|
101
78
|
let next = undefined;
|
|
102
79
|
let error = undefined;
|
|
103
80
|
let complete = undefined;
|
|
104
|
-
|
|
105
81
|
if (tsplus_module_2.isFunction(observer)) {
|
|
106
82
|
next = observer;
|
|
107
83
|
} else if (observer) {
|
|
@@ -114,7 +90,6 @@ class SafeSubscriber extends Subscriber {
|
|
|
114
90
|
error = error?.bind(observer);
|
|
115
91
|
complete = complete?.bind(observer);
|
|
116
92
|
}
|
|
117
|
-
|
|
118
93
|
if (error) {
|
|
119
94
|
this.observer = {
|
|
120
95
|
next: next ? wrapDefectHandler(next, error) : tsplus_module_3.noop,
|
|
@@ -129,11 +104,8 @@ class SafeSubscriber extends Subscriber {
|
|
|
129
104
|
};
|
|
130
105
|
}
|
|
131
106
|
}
|
|
132
|
-
|
|
133
107
|
}
|
|
134
|
-
|
|
135
108
|
exports.SafeSubscriber = SafeSubscriber;
|
|
136
|
-
|
|
137
109
|
function wrapDefectHandler(handler, onDefect) {
|
|
138
110
|
return (...args) => {
|
|
139
111
|
try {
|
|
@@ -143,7 +115,6 @@ function wrapDefectHandler(handler, onDefect) {
|
|
|
143
115
|
}
|
|
144
116
|
};
|
|
145
117
|
}
|
|
146
|
-
|
|
147
118
|
function wrapThrowHandler(handler) {
|
|
148
119
|
return (...args) => {
|
|
149
120
|
try {
|
|
@@ -153,11 +124,9 @@ function wrapThrowHandler(handler) {
|
|
|
153
124
|
}
|
|
154
125
|
};
|
|
155
126
|
}
|
|
156
|
-
|
|
157
127
|
function defaultErrorHandler(error) {
|
|
158
128
|
throw error;
|
|
159
129
|
}
|
|
160
|
-
|
|
161
130
|
const EMPTY_OBSERVER = {
|
|
162
131
|
closed: true,
|
|
163
132
|
next: tsplus_module_3.noop,
|
|
@@ -165,7 +134,6 @@ const EMPTY_OBSERVER = {
|
|
|
165
134
|
complete: tsplus_module_3.noop
|
|
166
135
|
};
|
|
167
136
|
exports.EMPTY_OBSERVER = EMPTY_OBSERVER;
|
|
168
|
-
|
|
169
137
|
function isSubscriber(u) {
|
|
170
138
|
return tsplus_module_2.isObject(u) && SubscriberTypeId in u;
|
|
171
139
|
}
|
package/_cjs/Subscriber.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Subscriber.cjs","mappings":"
|
|
1
|
+
{"version":3,"file":"Subscriber.cjs","mappings":";;;;;;;;;;;;;;AAAO,MAAMA,gBAAgB,gBAAGC,MAAM,CAACC,GAAG,CAAC,6BAA6B,CAAC;AAAC;AAGpE,MAAOC,UAAiB,SAAQC,4BAAY;EAMhDC,YAAYC,QAA4C;IACtD,KAAK,EAAE;IANA,QAAkB,GAAqBN,gBAAgB;IAExD,cAAS,GAAG,KAAK;IAKvB,IAAIM,QAAQ,EAAE;MACZ,IAAI,CAACA,QAAQ,GAAGA,QAAQ;MACxB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AC,CAAC;;EAE7B,CAAC;AACH;AAEA,SAASa,gBAAgB,CAACE,OAA4B;EACpD,OAAO,CAAC,GAAGE,IAAW,KAAI;IACxB,IAAI;MACFF,OAAO,CAAC,GAAGE,IAAI,CAAC;KACjB,CAAC,OAAOjB,GAAG,EAAE;MACZW,oCAAoB,CAACX,GAAG,CAAC;;EAE7B,CAAC;AACH;AAEA,SAASc,mBAAmB,CAACf,KAAU;EACrC,MAAMA,KAAK;AACb;AAEO,MAAML,cAAc,GAEvB;EACFW,MAAM,EAAE,IAAI;EACZV,IAAI,kBAAEiB,IAAI;EACVb,KAAK,EAAEe,mBAAmB;EAC1BZ,QAAQ,kBAAEU;CACX;AAAC;AAEI,SAAUO,YAAY,CAACC,CAAU;EACrC,OAAOZ,wBAAQ,CAACY,CAAC,CAAC,IAAIlC,gBAAgB,IAAIkC,CAAC;AAC7C","names":["SubscriberTypeId","Symbol","for","Subscriber","tsplus_module_1","constructor","observer","add","EMPTY_OBSERVER","next","value","isStopped","_next","error","err","_error","complete","_complete","unsubscribe","closed","SafeSubscriber","undefined","tsplus_module_2","bind","wrapDefectHandler","tsplus_module_3","noop","wrapThrowHandler","defaultErrorHandler","handler","onDefect","args","tsplus_module_4","isSubscriber","u"],"sourceRoot":"","sources":["../_src/Subscriber.ts"],"sourcesContent":[null]}
|
package/_cjs/Subscription.cjs
CHANGED
|
@@ -6,23 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.UnsubscribeErrorTypeId = exports.UnsubscribeError = exports.SubscriptionTypeId = exports.Subscription = exports.EMPTY_SUBSCRIPTION = void 0;
|
|
7
7
|
exports.isSubscription = isSubscription;
|
|
8
8
|
exports.isUnsubscribeError = isUnsubscribeError;
|
|
9
|
-
|
|
10
9
|
var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/util/predicates"));
|
|
11
|
-
|
|
12
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
|
|
14
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
|
|
16
12
|
var _a, _b;
|
|
17
|
-
|
|
18
13
|
const SubscriptionTypeId = /*#__PURE__*/Symbol.for("@fncts/observable/Subscription");
|
|
19
14
|
/**
|
|
20
15
|
* @tsplus type fncts.observable.Subscription
|
|
21
16
|
* @tsplus companion fncts.observable.SubscriptionOps
|
|
22
17
|
*/
|
|
23
|
-
|
|
24
18
|
exports.SubscriptionTypeId = SubscriptionTypeId;
|
|
25
|
-
|
|
26
19
|
class Subscription {
|
|
27
20
|
constructor(initialFinalizer) {
|
|
28
21
|
this.initialFinalizer = initialFinalizer;
|
|
@@ -31,10 +24,8 @@ class Subscription {
|
|
|
31
24
|
this.finalizers = null;
|
|
32
25
|
this.parents = null;
|
|
33
26
|
}
|
|
34
|
-
|
|
35
27
|
unsubscribe() {
|
|
36
28
|
let errors;
|
|
37
|
-
|
|
38
29
|
if (!this.closed) {
|
|
39
30
|
this.closed = true;
|
|
40
31
|
const {
|
|
@@ -42,15 +33,12 @@ class Subscription {
|
|
|
42
33
|
initialFinalizer,
|
|
43
34
|
finalizers
|
|
44
35
|
} = this;
|
|
45
|
-
|
|
46
36
|
if (parents) {
|
|
47
37
|
this.parents = null;
|
|
48
|
-
|
|
49
38
|
for (const parent of parents) {
|
|
50
39
|
parent.remove(this);
|
|
51
40
|
}
|
|
52
41
|
}
|
|
53
|
-
|
|
54
42
|
if (initialFinalizer) {
|
|
55
43
|
try {
|
|
56
44
|
initialFinalizer();
|
|
@@ -58,16 +46,13 @@ class Subscription {
|
|
|
58
46
|
errors = isUnsubscribeError(e) ? e.errors : [e];
|
|
59
47
|
}
|
|
60
48
|
}
|
|
61
|
-
|
|
62
49
|
if (finalizers) {
|
|
63
50
|
this.finalizers = null;
|
|
64
|
-
|
|
65
51
|
for (const finalizer of finalizers) {
|
|
66
52
|
try {
|
|
67
53
|
executeFinalizer(finalizer);
|
|
68
54
|
} catch (e) {
|
|
69
55
|
errors || (errors = []);
|
|
70
|
-
|
|
71
56
|
if (isUnsubscribeError(e)) {
|
|
72
57
|
errors.push(...e.errors);
|
|
73
58
|
} else {
|
|
@@ -77,12 +62,10 @@ class Subscription {
|
|
|
77
62
|
}
|
|
78
63
|
}
|
|
79
64
|
}
|
|
80
|
-
|
|
81
65
|
if (errors) {
|
|
82
66
|
throw new UnsubscribeError(errors);
|
|
83
67
|
}
|
|
84
68
|
}
|
|
85
|
-
|
|
86
69
|
add(finalizer) {
|
|
87
70
|
if (finalizer && finalizer !== this) {
|
|
88
71
|
if (this.closed) {
|
|
@@ -92,82 +75,62 @@ class Subscription {
|
|
|
92
75
|
if (finalizer.closed || finalizer.hasParent(this)) {
|
|
93
76
|
return;
|
|
94
77
|
}
|
|
95
|
-
|
|
96
78
|
finalizer.addParent(this);
|
|
97
79
|
}
|
|
98
|
-
|
|
99
80
|
if (!this.finalizers) {
|
|
100
81
|
this.finalizers = new Set();
|
|
101
82
|
}
|
|
102
|
-
|
|
103
83
|
this.finalizers.add(finalizer);
|
|
104
84
|
}
|
|
105
85
|
}
|
|
106
86
|
}
|
|
107
|
-
|
|
108
87
|
hasParent(parent) {
|
|
109
88
|
const parentage = this.parents;
|
|
110
89
|
return parentage ? parentage.has(parent) : false;
|
|
111
90
|
}
|
|
112
|
-
|
|
113
91
|
addParent(parent) {
|
|
114
92
|
if (!this.parents) {
|
|
115
93
|
this.parents = new Set();
|
|
116
94
|
}
|
|
117
|
-
|
|
118
95
|
this.parents.add(parent);
|
|
119
96
|
}
|
|
120
|
-
|
|
121
97
|
removeParent(parent) {
|
|
122
98
|
this.parents?.delete(parent);
|
|
123
99
|
}
|
|
124
|
-
|
|
125
100
|
remove(finalizer) {
|
|
126
101
|
this.finalizers?.delete(finalizer);
|
|
127
|
-
|
|
128
102
|
if (isSubscription(finalizer)) {
|
|
129
103
|
finalizer.removeParent(this);
|
|
130
104
|
}
|
|
131
105
|
}
|
|
132
|
-
|
|
133
106
|
}
|
|
134
|
-
|
|
135
107
|
exports.Subscription = Subscription;
|
|
136
108
|
_a = SubscriptionTypeId;
|
|
137
|
-
|
|
138
109
|
function isSubscription(u) {
|
|
139
110
|
return tsplus_module_1.isObject(u) && SubscriptionTypeId in u;
|
|
140
111
|
}
|
|
141
|
-
|
|
142
112
|
function executeFinalizer(finalizer) {
|
|
143
113
|
return finalizer && ("unsubscribe" in finalizer ? finalizer.unsubscribe() : finalizer());
|
|
144
114
|
}
|
|
145
115
|
/**
|
|
146
116
|
* @tsplus static fncts.observable.SubscriptionOps empty
|
|
147
117
|
*/
|
|
148
|
-
|
|
149
|
-
|
|
150
118
|
const EMPTY_SUBSCRIPTION = /*#__PURE__*/(() => {
|
|
151
119
|
const empty = /*#__PURE__*/new Subscription();
|
|
152
120
|
empty.closed = true;
|
|
153
121
|
return empty;
|
|
154
122
|
})();
|
|
155
|
-
|
|
156
123
|
exports.EMPTY_SUBSCRIPTION = EMPTY_SUBSCRIPTION;
|
|
157
124
|
const UnsubscribeErrorTypeId = /*#__PURE__*/Symbol.for("@principia/observable/UnsubscribeError");
|
|
158
125
|
exports.UnsubscribeErrorTypeId = UnsubscribeErrorTypeId;
|
|
159
|
-
|
|
160
126
|
class UnsubscribeError {
|
|
161
127
|
constructor(errors) {
|
|
162
128
|
this.errors = errors;
|
|
163
129
|
this[_b] = UnsubscribeErrorTypeId;
|
|
164
130
|
}
|
|
165
|
-
|
|
166
131
|
}
|
|
167
|
-
|
|
168
132
|
exports.UnsubscribeError = UnsubscribeError;
|
|
169
133
|
_b = UnsubscribeErrorTypeId;
|
|
170
|
-
|
|
171
134
|
function isUnsubscribeError(u) {
|
|
172
135
|
return tsplus_module_1.isObject(u) && UnsubscribeErrorTypeId in u;
|
|
173
136
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Subscription.cjs","mappings":"
|
|
1
|
+
{"version":3,"file":"Subscription.cjs","mappings":";;;;;;;;;;;;AAUO,MAAMA,kBAAkB,gBAAGC,MAAM,CAACC,GAAG,CAAC,gCAAgC,CAAC;AAG9E;;;;AAAA;AAIM,MAAOC,YAAY;EAOvBC,YAAoBC,gBAA6B;IAA7B,qBAAgB,GAAhBA,gBAAgB;IAN3B,QAAoB,GAAuBL,kBAAkB;IAE/D,WAAM,GAAG,KAAK;IACb,eAAU,GAA0B,IAAI;IACxC,YAAO,GAA6B,IAAI;EAEI;EAEpDM,WAAW;IACT,IAAIC,MAA6B;IAEjC,IAAI,CAAC,IAAI,CAACC,MAAM,EAAE;MAChB,IAAI,CAACA,MAAM,GAAG,IAAI;MAElB,MAAM;QAAEC,OAAO;QAAEJ,gBAAgB;QAAEK;MAAU,CAAE,GAAG,IAAI;MAEtD,IAAID,OAAO,EAAE;QACX,IAAI,CAACA,OAAO,GAAG,IAAI;QACnB,KAAK,MAAME,MAAM,IAAIF,OAAO,EAAE;UAC5BE,MAAM,CAACC,MAAM,CAAC,IAAI,CAAC;;;MAIvB,IAAIP,gBAAgB,EAAE;QACpB,IAAI;UACFA,gBAAgB,EAAE;SACnB,CAAC,OAAOQ,CAAC,EAAE;UACVN,MAAM,GAAGO,kBAAk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initialFinalizer","unsubscribe","errors","closed","parents","finalizers","parent","remove","e","isUnsubscribeError","finalizer","executeFinalizer","push","UnsubscribeError","add","isSubscription","hasParent","addParent","Set","parentage","has","removeParent","delete","u","tsplus_module_1","EMPTY_SUBSCRIPTION","empty","UnsubscribeErrorTypeId"],"sourceRoot":"","sources":["../_src/Subscription.ts"],"sourcesContent":[null]}
|