@elice/material-shared-utils 1.260220.0 → 1.260429.0-improvetimerpopoverui.0
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/cjs/material-config/MaterialConfigContext.js +2 -2
- package/cjs/material-config/MaterialConfigProvider.d.ts +3 -1
- package/es/material-config/MaterialConfigContext.js +1 -1
- package/es/material-config/MaterialConfigProvider.d.ts +3 -1
- package/package.json +23 -14
- package/cjs/node_modules/rxjs/dist/esm5/internal/BehaviorSubject.js +0 -39
- package/cjs/node_modules/rxjs/dist/esm5/internal/Observable.js +0 -105
- package/cjs/node_modules/rxjs/dist/esm5/internal/Subject.js +0 -165
- package/cjs/node_modules/rxjs/dist/esm5/internal/Subscriber.js +0 -157
- package/cjs/node_modules/rxjs/dist/esm5/internal/Subscription.js +0 -148
- package/cjs/node_modules/rxjs/dist/esm5/internal/config.js +0 -6
- package/cjs/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +0 -19
- package/cjs/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +0 -5
- package/cjs/node_modules/rxjs/dist/esm5/internal/util/ObjectUnsubscribedError.js +0 -13
- package/cjs/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +0 -16
- package/cjs/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +0 -10
- package/cjs/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +0 -14
- package/cjs/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +0 -9
- package/cjs/node_modules/rxjs/dist/esm5/internal/util/identity.js +0 -7
- package/cjs/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +0 -7
- package/cjs/node_modules/rxjs/dist/esm5/internal/util/noop.js +0 -5
- package/cjs/node_modules/rxjs/dist/esm5/internal/util/pipe.js +0 -17
- package/cjs/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +0 -13
- package/es/node_modules/rxjs/dist/esm5/internal/BehaviorSubject.js +0 -37
- package/es/node_modules/rxjs/dist/esm5/internal/Observable.js +0 -103
- package/es/node_modules/rxjs/dist/esm5/internal/Subject.js +0 -162
- package/es/node_modules/rxjs/dist/esm5/internal/Subscriber.js +0 -153
- package/es/node_modules/rxjs/dist/esm5/internal/Subscription.js +0 -144
- package/es/node_modules/rxjs/dist/esm5/internal/config.js +0 -4
- package/es/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +0 -17
- package/es/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +0 -3
- package/es/node_modules/rxjs/dist/esm5/internal/util/ObjectUnsubscribedError.js +0 -11
- package/es/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +0 -14
- package/es/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +0 -8
- package/es/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +0 -12
- package/es/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +0 -7
- package/es/node_modules/rxjs/dist/esm5/internal/util/identity.js +0 -5
- package/es/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +0 -5
- package/es/node_modules/rxjs/dist/esm5/internal/util/noop.js +0 -3
- package/es/node_modules/rxjs/dist/esm5/internal/util/pipe.js +0 -15
- package/es/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +0 -11
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var tslib = require('tslib');
|
|
4
|
-
var isFunction = require('./util/isFunction.js');
|
|
5
|
-
var UnsubscriptionError = require('./util/UnsubscriptionError.js');
|
|
6
|
-
var arrRemove = require('./util/arrRemove.js');
|
|
7
|
-
|
|
8
|
-
var Subscription = (function () {
|
|
9
|
-
function Subscription(initialTeardown) {
|
|
10
|
-
this.initialTeardown = initialTeardown;
|
|
11
|
-
this.closed = false;
|
|
12
|
-
this._parentage = null;
|
|
13
|
-
this._finalizers = null;
|
|
14
|
-
}
|
|
15
|
-
Subscription.prototype.unsubscribe = function () {
|
|
16
|
-
var e_1, _a, e_2, _b;
|
|
17
|
-
var errors;
|
|
18
|
-
if (!this.closed) {
|
|
19
|
-
this.closed = true;
|
|
20
|
-
var _parentage = this._parentage;
|
|
21
|
-
if (_parentage) {
|
|
22
|
-
this._parentage = null;
|
|
23
|
-
if (Array.isArray(_parentage)) {
|
|
24
|
-
try {
|
|
25
|
-
for (var _parentage_1 = tslib.__values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
|
|
26
|
-
var parent_1 = _parentage_1_1.value;
|
|
27
|
-
parent_1.remove(this);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
31
|
-
finally {
|
|
32
|
-
try {
|
|
33
|
-
if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
|
|
34
|
-
}
|
|
35
|
-
finally { if (e_1) throw e_1.error; }
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
_parentage.remove(this);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
var initialFinalizer = this.initialTeardown;
|
|
43
|
-
if (isFunction.isFunction(initialFinalizer)) {
|
|
44
|
-
try {
|
|
45
|
-
initialFinalizer();
|
|
46
|
-
}
|
|
47
|
-
catch (e) {
|
|
48
|
-
errors = e instanceof UnsubscriptionError.UnsubscriptionError ? e.errors : [e];
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
var _finalizers = this._finalizers;
|
|
52
|
-
if (_finalizers) {
|
|
53
|
-
this._finalizers = null;
|
|
54
|
-
try {
|
|
55
|
-
for (var _finalizers_1 = tslib.__values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
|
|
56
|
-
var finalizer = _finalizers_1_1.value;
|
|
57
|
-
try {
|
|
58
|
-
execFinalizer(finalizer);
|
|
59
|
-
}
|
|
60
|
-
catch (err) {
|
|
61
|
-
errors = errors !== null && errors !== void 0 ? errors : [];
|
|
62
|
-
if (err instanceof UnsubscriptionError.UnsubscriptionError) {
|
|
63
|
-
errors = tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(errors)), tslib.__read(err.errors));
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
errors.push(err);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
72
|
-
finally {
|
|
73
|
-
try {
|
|
74
|
-
if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
|
|
75
|
-
}
|
|
76
|
-
finally { if (e_2) throw e_2.error; }
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
if (errors) {
|
|
80
|
-
throw new UnsubscriptionError.UnsubscriptionError(errors);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
Subscription.prototype.add = function (teardown) {
|
|
85
|
-
var _a;
|
|
86
|
-
if (teardown && teardown !== this) {
|
|
87
|
-
if (this.closed) {
|
|
88
|
-
execFinalizer(teardown);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
if (teardown instanceof Subscription) {
|
|
92
|
-
if (teardown.closed || teardown._hasParent(this)) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
teardown._addParent(this);
|
|
96
|
-
}
|
|
97
|
-
(this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
Subscription.prototype._hasParent = function (parent) {
|
|
102
|
-
var _parentage = this._parentage;
|
|
103
|
-
return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
|
|
104
|
-
};
|
|
105
|
-
Subscription.prototype._addParent = function (parent) {
|
|
106
|
-
var _parentage = this._parentage;
|
|
107
|
-
this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
|
|
108
|
-
};
|
|
109
|
-
Subscription.prototype._removeParent = function (parent) {
|
|
110
|
-
var _parentage = this._parentage;
|
|
111
|
-
if (_parentage === parent) {
|
|
112
|
-
this._parentage = null;
|
|
113
|
-
}
|
|
114
|
-
else if (Array.isArray(_parentage)) {
|
|
115
|
-
arrRemove.arrRemove(_parentage, parent);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
Subscription.prototype.remove = function (teardown) {
|
|
119
|
-
var _finalizers = this._finalizers;
|
|
120
|
-
_finalizers && arrRemove.arrRemove(_finalizers, teardown);
|
|
121
|
-
if (teardown instanceof Subscription) {
|
|
122
|
-
teardown._removeParent(this);
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
Subscription.EMPTY = (function () {
|
|
126
|
-
var empty = new Subscription();
|
|
127
|
-
empty.closed = true;
|
|
128
|
-
return empty;
|
|
129
|
-
})();
|
|
130
|
-
return Subscription;
|
|
131
|
-
}());
|
|
132
|
-
var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
|
|
133
|
-
function isSubscription(value) {
|
|
134
|
-
return (value instanceof Subscription ||
|
|
135
|
-
(value && 'closed' in value && isFunction.isFunction(value.remove) && isFunction.isFunction(value.add) && isFunction.isFunction(value.unsubscribe)));
|
|
136
|
-
}
|
|
137
|
-
function execFinalizer(finalizer) {
|
|
138
|
-
if (isFunction.isFunction(finalizer)) {
|
|
139
|
-
finalizer();
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
finalizer.unsubscribe();
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
exports.EMPTY_SUBSCRIPTION = EMPTY_SUBSCRIPTION;
|
|
147
|
-
exports.Subscription = Subscription;
|
|
148
|
-
exports.isSubscription = isSubscription;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var tslib = require('tslib');
|
|
4
|
-
|
|
5
|
-
var timeoutProvider = {
|
|
6
|
-
setTimeout: function (handler, timeout) {
|
|
7
|
-
var args = [];
|
|
8
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
9
|
-
args[_i - 2] = arguments[_i];
|
|
10
|
-
}
|
|
11
|
-
return setTimeout.apply(void 0, tslib.__spreadArray([handler, timeout], tslib.__read(args)));
|
|
12
|
-
},
|
|
13
|
-
clearTimeout: function (handle) {
|
|
14
|
-
return (clearTimeout)(handle);
|
|
15
|
-
},
|
|
16
|
-
delegate: undefined,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
exports.timeoutProvider = timeoutProvider;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var createErrorClass = require('./createErrorClass.js');
|
|
4
|
-
|
|
5
|
-
var ObjectUnsubscribedError = createErrorClass.createErrorClass(function (_super) {
|
|
6
|
-
return function ObjectUnsubscribedErrorImpl() {
|
|
7
|
-
_super(this);
|
|
8
|
-
this.name = 'ObjectUnsubscribedError';
|
|
9
|
-
this.message = 'object unsubscribed';
|
|
10
|
-
};
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
exports.ObjectUnsubscribedError = ObjectUnsubscribedError;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var createErrorClass = require('./createErrorClass.js');
|
|
4
|
-
|
|
5
|
-
var UnsubscriptionError = createErrorClass.createErrorClass(function (_super) {
|
|
6
|
-
return function UnsubscriptionErrorImpl(errors) {
|
|
7
|
-
_super(this);
|
|
8
|
-
this.message = errors
|
|
9
|
-
? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
|
|
10
|
-
: '';
|
|
11
|
-
this.name = 'UnsubscriptionError';
|
|
12
|
-
this.errors = errors;
|
|
13
|
-
};
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
exports.UnsubscriptionError = UnsubscriptionError;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function createErrorClass(createImpl) {
|
|
4
|
-
var _super = function (instance) {
|
|
5
|
-
Error.call(instance);
|
|
6
|
-
instance.stack = new Error().stack;
|
|
7
|
-
};
|
|
8
|
-
var ctorFunc = createImpl(_super);
|
|
9
|
-
ctorFunc.prototype = Object.create(Error.prototype);
|
|
10
|
-
ctorFunc.prototype.constructor = ctorFunc;
|
|
11
|
-
return ctorFunc;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
exports.createErrorClass = createErrorClass;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var identity = require('./identity.js');
|
|
4
|
-
|
|
5
|
-
function pipeFromArray(fns) {
|
|
6
|
-
if (fns.length === 0) {
|
|
7
|
-
return identity.identity;
|
|
8
|
-
}
|
|
9
|
-
if (fns.length === 1) {
|
|
10
|
-
return fns[0];
|
|
11
|
-
}
|
|
12
|
-
return function piped(input) {
|
|
13
|
-
return fns.reduce(function (prev, fn) { return fn(prev); }, input);
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
exports.pipeFromArray = pipeFromArray;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var timeoutProvider = require('../scheduler/timeoutProvider.js');
|
|
4
|
-
|
|
5
|
-
function reportUnhandledError(err) {
|
|
6
|
-
timeoutProvider.timeoutProvider.setTimeout(function () {
|
|
7
|
-
{
|
|
8
|
-
throw err;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
exports.reportUnhandledError = reportUnhandledError;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { __extends } from 'tslib';
|
|
2
|
-
import { Subject } from './Subject.js';
|
|
3
|
-
|
|
4
|
-
var BehaviorSubject = (function (_super) {
|
|
5
|
-
__extends(BehaviorSubject, _super);
|
|
6
|
-
function BehaviorSubject(_value) {
|
|
7
|
-
var _this = _super.call(this) || this;
|
|
8
|
-
_this._value = _value;
|
|
9
|
-
return _this;
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(BehaviorSubject.prototype, "value", {
|
|
12
|
-
get: function () {
|
|
13
|
-
return this.getValue();
|
|
14
|
-
},
|
|
15
|
-
enumerable: false,
|
|
16
|
-
configurable: true
|
|
17
|
-
});
|
|
18
|
-
BehaviorSubject.prototype._subscribe = function (subscriber) {
|
|
19
|
-
var subscription = _super.prototype._subscribe.call(this, subscriber);
|
|
20
|
-
!subscription.closed && subscriber.next(this._value);
|
|
21
|
-
return subscription;
|
|
22
|
-
};
|
|
23
|
-
BehaviorSubject.prototype.getValue = function () {
|
|
24
|
-
var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, _value = _a._value;
|
|
25
|
-
if (hasError) {
|
|
26
|
-
throw thrownError;
|
|
27
|
-
}
|
|
28
|
-
this._throwIfClosed();
|
|
29
|
-
return _value;
|
|
30
|
-
};
|
|
31
|
-
BehaviorSubject.prototype.next = function (value) {
|
|
32
|
-
_super.prototype.next.call(this, (this._value = value));
|
|
33
|
-
};
|
|
34
|
-
return BehaviorSubject;
|
|
35
|
-
}(Subject));
|
|
36
|
-
|
|
37
|
-
export { BehaviorSubject };
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { SafeSubscriber, Subscriber } from './Subscriber.js';
|
|
2
|
-
import { isSubscription } from './Subscription.js';
|
|
3
|
-
import { observable } from './symbol/observable.js';
|
|
4
|
-
import { pipeFromArray } from './util/pipe.js';
|
|
5
|
-
import { config } from './config.js';
|
|
6
|
-
import { isFunction } from './util/isFunction.js';
|
|
7
|
-
import { errorContext } from './util/errorContext.js';
|
|
8
|
-
|
|
9
|
-
var Observable = (function () {
|
|
10
|
-
function Observable(subscribe) {
|
|
11
|
-
if (subscribe) {
|
|
12
|
-
this._subscribe = subscribe;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
Observable.prototype.lift = function (operator) {
|
|
16
|
-
var observable = new Observable();
|
|
17
|
-
observable.source = this;
|
|
18
|
-
observable.operator = operator;
|
|
19
|
-
return observable;
|
|
20
|
-
};
|
|
21
|
-
Observable.prototype.subscribe = function (observerOrNext, error, complete) {
|
|
22
|
-
var _this = this;
|
|
23
|
-
var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
|
|
24
|
-
errorContext(function () {
|
|
25
|
-
var _a = _this, operator = _a.operator, source = _a.source;
|
|
26
|
-
subscriber.add(operator
|
|
27
|
-
?
|
|
28
|
-
operator.call(subscriber, source)
|
|
29
|
-
: source
|
|
30
|
-
?
|
|
31
|
-
_this._subscribe(subscriber)
|
|
32
|
-
:
|
|
33
|
-
_this._trySubscribe(subscriber));
|
|
34
|
-
});
|
|
35
|
-
return subscriber;
|
|
36
|
-
};
|
|
37
|
-
Observable.prototype._trySubscribe = function (sink) {
|
|
38
|
-
try {
|
|
39
|
-
return this._subscribe(sink);
|
|
40
|
-
}
|
|
41
|
-
catch (err) {
|
|
42
|
-
sink.error(err);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
Observable.prototype.forEach = function (next, promiseCtor) {
|
|
46
|
-
var _this = this;
|
|
47
|
-
promiseCtor = getPromiseCtor(promiseCtor);
|
|
48
|
-
return new promiseCtor(function (resolve, reject) {
|
|
49
|
-
var subscriber = new SafeSubscriber({
|
|
50
|
-
next: function (value) {
|
|
51
|
-
try {
|
|
52
|
-
next(value);
|
|
53
|
-
}
|
|
54
|
-
catch (err) {
|
|
55
|
-
reject(err);
|
|
56
|
-
subscriber.unsubscribe();
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
error: reject,
|
|
60
|
-
complete: resolve,
|
|
61
|
-
});
|
|
62
|
-
_this.subscribe(subscriber);
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
Observable.prototype._subscribe = function (subscriber) {
|
|
66
|
-
var _a;
|
|
67
|
-
return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
|
|
68
|
-
};
|
|
69
|
-
Observable.prototype[observable] = function () {
|
|
70
|
-
return this;
|
|
71
|
-
};
|
|
72
|
-
Observable.prototype.pipe = function () {
|
|
73
|
-
var operations = [];
|
|
74
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
75
|
-
operations[_i] = arguments[_i];
|
|
76
|
-
}
|
|
77
|
-
return pipeFromArray(operations)(this);
|
|
78
|
-
};
|
|
79
|
-
Observable.prototype.toPromise = function (promiseCtor) {
|
|
80
|
-
var _this = this;
|
|
81
|
-
promiseCtor = getPromiseCtor(promiseCtor);
|
|
82
|
-
return new promiseCtor(function (resolve, reject) {
|
|
83
|
-
var value;
|
|
84
|
-
_this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
Observable.create = function (subscribe) {
|
|
88
|
-
return new Observable(subscribe);
|
|
89
|
-
};
|
|
90
|
-
return Observable;
|
|
91
|
-
}());
|
|
92
|
-
function getPromiseCtor(promiseCtor) {
|
|
93
|
-
var _a;
|
|
94
|
-
return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
|
|
95
|
-
}
|
|
96
|
-
function isObserver(value) {
|
|
97
|
-
return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
|
|
98
|
-
}
|
|
99
|
-
function isSubscriber(value) {
|
|
100
|
-
return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export { Observable };
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { __extends, __values } from 'tslib';
|
|
2
|
-
import { Observable } from './Observable.js';
|
|
3
|
-
import { EMPTY_SUBSCRIPTION, Subscription } from './Subscription.js';
|
|
4
|
-
import { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError.js';
|
|
5
|
-
import { arrRemove } from './util/arrRemove.js';
|
|
6
|
-
import { errorContext } from './util/errorContext.js';
|
|
7
|
-
|
|
8
|
-
var Subject = (function (_super) {
|
|
9
|
-
__extends(Subject, _super);
|
|
10
|
-
function Subject() {
|
|
11
|
-
var _this = _super.call(this) || this;
|
|
12
|
-
_this.closed = false;
|
|
13
|
-
_this.currentObservers = null;
|
|
14
|
-
_this.observers = [];
|
|
15
|
-
_this.isStopped = false;
|
|
16
|
-
_this.hasError = false;
|
|
17
|
-
_this.thrownError = null;
|
|
18
|
-
return _this;
|
|
19
|
-
}
|
|
20
|
-
Subject.prototype.lift = function (operator) {
|
|
21
|
-
var subject = new AnonymousSubject(this, this);
|
|
22
|
-
subject.operator = operator;
|
|
23
|
-
return subject;
|
|
24
|
-
};
|
|
25
|
-
Subject.prototype._throwIfClosed = function () {
|
|
26
|
-
if (this.closed) {
|
|
27
|
-
throw new ObjectUnsubscribedError();
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
Subject.prototype.next = function (value) {
|
|
31
|
-
var _this = this;
|
|
32
|
-
errorContext(function () {
|
|
33
|
-
var e_1, _a;
|
|
34
|
-
_this._throwIfClosed();
|
|
35
|
-
if (!_this.isStopped) {
|
|
36
|
-
if (!_this.currentObservers) {
|
|
37
|
-
_this.currentObservers = Array.from(_this.observers);
|
|
38
|
-
}
|
|
39
|
-
try {
|
|
40
|
-
for (var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
41
|
-
var observer = _c.value;
|
|
42
|
-
observer.next(value);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
46
|
-
finally {
|
|
47
|
-
try {
|
|
48
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
49
|
-
}
|
|
50
|
-
finally { if (e_1) throw e_1.error; }
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
Subject.prototype.error = function (err) {
|
|
56
|
-
var _this = this;
|
|
57
|
-
errorContext(function () {
|
|
58
|
-
_this._throwIfClosed();
|
|
59
|
-
if (!_this.isStopped) {
|
|
60
|
-
_this.hasError = _this.isStopped = true;
|
|
61
|
-
_this.thrownError = err;
|
|
62
|
-
var observers = _this.observers;
|
|
63
|
-
while (observers.length) {
|
|
64
|
-
observers.shift().error(err);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
Subject.prototype.complete = function () {
|
|
70
|
-
var _this = this;
|
|
71
|
-
errorContext(function () {
|
|
72
|
-
_this._throwIfClosed();
|
|
73
|
-
if (!_this.isStopped) {
|
|
74
|
-
_this.isStopped = true;
|
|
75
|
-
var observers = _this.observers;
|
|
76
|
-
while (observers.length) {
|
|
77
|
-
observers.shift().complete();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
Subject.prototype.unsubscribe = function () {
|
|
83
|
-
this.isStopped = this.closed = true;
|
|
84
|
-
this.observers = this.currentObservers = null;
|
|
85
|
-
};
|
|
86
|
-
Object.defineProperty(Subject.prototype, "observed", {
|
|
87
|
-
get: function () {
|
|
88
|
-
var _a;
|
|
89
|
-
return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
90
|
-
},
|
|
91
|
-
enumerable: false,
|
|
92
|
-
configurable: true
|
|
93
|
-
});
|
|
94
|
-
Subject.prototype._trySubscribe = function (subscriber) {
|
|
95
|
-
this._throwIfClosed();
|
|
96
|
-
return _super.prototype._trySubscribe.call(this, subscriber);
|
|
97
|
-
};
|
|
98
|
-
Subject.prototype._subscribe = function (subscriber) {
|
|
99
|
-
this._throwIfClosed();
|
|
100
|
-
this._checkFinalizedStatuses(subscriber);
|
|
101
|
-
return this._innerSubscribe(subscriber);
|
|
102
|
-
};
|
|
103
|
-
Subject.prototype._innerSubscribe = function (subscriber) {
|
|
104
|
-
var _this = this;
|
|
105
|
-
var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
|
|
106
|
-
if (hasError || isStopped) {
|
|
107
|
-
return EMPTY_SUBSCRIPTION;
|
|
108
|
-
}
|
|
109
|
-
this.currentObservers = null;
|
|
110
|
-
observers.push(subscriber);
|
|
111
|
-
return new Subscription(function () {
|
|
112
|
-
_this.currentObservers = null;
|
|
113
|
-
arrRemove(observers, subscriber);
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
Subject.prototype._checkFinalizedStatuses = function (subscriber) {
|
|
117
|
-
var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
|
|
118
|
-
if (hasError) {
|
|
119
|
-
subscriber.error(thrownError);
|
|
120
|
-
}
|
|
121
|
-
else if (isStopped) {
|
|
122
|
-
subscriber.complete();
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
Subject.prototype.asObservable = function () {
|
|
126
|
-
var observable = new Observable();
|
|
127
|
-
observable.source = this;
|
|
128
|
-
return observable;
|
|
129
|
-
};
|
|
130
|
-
Subject.create = function (destination, source) {
|
|
131
|
-
return new AnonymousSubject(destination, source);
|
|
132
|
-
};
|
|
133
|
-
return Subject;
|
|
134
|
-
}(Observable));
|
|
135
|
-
var AnonymousSubject = (function (_super) {
|
|
136
|
-
__extends(AnonymousSubject, _super);
|
|
137
|
-
function AnonymousSubject(destination, source) {
|
|
138
|
-
var _this = _super.call(this) || this;
|
|
139
|
-
_this.destination = destination;
|
|
140
|
-
_this.source = source;
|
|
141
|
-
return _this;
|
|
142
|
-
}
|
|
143
|
-
AnonymousSubject.prototype.next = function (value) {
|
|
144
|
-
var _a, _b;
|
|
145
|
-
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
|
|
146
|
-
};
|
|
147
|
-
AnonymousSubject.prototype.error = function (err) {
|
|
148
|
-
var _a, _b;
|
|
149
|
-
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
|
|
150
|
-
};
|
|
151
|
-
AnonymousSubject.prototype.complete = function () {
|
|
152
|
-
var _a, _b;
|
|
153
|
-
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
154
|
-
};
|
|
155
|
-
AnonymousSubject.prototype._subscribe = function (subscriber) {
|
|
156
|
-
var _a, _b;
|
|
157
|
-
return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
|
|
158
|
-
};
|
|
159
|
-
return AnonymousSubject;
|
|
160
|
-
}(Subject));
|
|
161
|
-
|
|
162
|
-
export { AnonymousSubject, Subject };
|