aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/rxjs/dist/esm5/internal/Subject.js
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2025-06-28 17:26:46 -0700
committerPinapelz <yukais@pinapelz.com>2025-06-28 17:43:56 -0700
commite4fa1e69e7ebfb627c7198fd1a9881e9327ec4d4 (patch)
tree06284a538a6008eca75051399e47db4e5d50301c /node_modules/rxjs/dist/esm5/internal/Subject.js
initial commit: scaffolding
Diffstat (limited to 'node_modules/rxjs/dist/esm5/internal/Subject.js')
-rw-r--r--node_modules/rxjs/dist/esm5/internal/Subject.js162
1 files changed, 162 insertions, 0 deletions
diff --git a/node_modules/rxjs/dist/esm5/internal/Subject.js b/node_modules/rxjs/dist/esm5/internal/Subject.js
new file mode 100644
index 0000000..b29d8f6
--- /dev/null
+++ b/node_modules/rxjs/dist/esm5/internal/Subject.js
@@ -0,0 +1,162 @@
+import { __extends, __values } from "tslib";
+import { Observable } from './Observable';
+import { Subscription, EMPTY_SUBSCRIPTION } from './Subscription';
+import { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError';
+import { arrRemove } from './util/arrRemove';
+import { errorContext } from './util/errorContext';
+var Subject = (function (_super) {
+ __extends(Subject, _super);
+ function Subject() {
+ var _this = _super.call(this) || this;
+ _this.closed = false;
+ _this.currentObservers = null;
+ _this.observers = [];
+ _this.isStopped = false;
+ _this.hasError = false;
+ _this.thrownError = null;
+ return _this;
+ }
+ Subject.prototype.lift = function (operator) {
+ var subject = new AnonymousSubject(this, this);
+ subject.operator = operator;
+ return subject;
+ };
+ Subject.prototype._throwIfClosed = function () {
+ if (this.closed) {
+ throw new ObjectUnsubscribedError();
+ }
+ };
+ Subject.prototype.next = function (value) {
+ var _this = this;
+ errorContext(function () {
+ var e_1, _a;
+ _this._throwIfClosed();
+ if (!_this.isStopped) {
+ if (!_this.currentObservers) {
+ _this.currentObservers = Array.from(_this.observers);
+ }
+ try {
+ for (var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
+ var observer = _c.value;
+ observer.next(value);
+ }
+ }
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
+ finally {
+ try {
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
+ }
+ finally { if (e_1) throw e_1.error; }
+ }
+ }
+ });
+ };
+ Subject.prototype.error = function (err) {
+ var _this = this;
+ errorContext(function () {
+ _this._throwIfClosed();
+ if (!_this.isStopped) {
+ _this.hasError = _this.isStopped = true;
+ _this.thrownError = err;
+ var observers = _this.observers;
+ while (observers.length) {
+ observers.shift().error(err);
+ }
+ }
+ });
+ };
+ Subject.prototype.complete = function () {
+ var _this = this;
+ errorContext(function () {
+ _this._throwIfClosed();
+ if (!_this.isStopped) {
+ _this.isStopped = true;
+ var observers = _this.observers;
+ while (observers.length) {
+ observers.shift().complete();
+ }
+ }
+ });
+ };
+ Subject.prototype.unsubscribe = function () {
+ this.isStopped = this.closed = true;
+ this.observers = this.currentObservers = null;
+ };
+ Object.defineProperty(Subject.prototype, "observed", {
+ get: function () {
+ var _a;
+ return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
+ },
+ enumerable: false,
+ configurable: true
+ });
+ Subject.prototype._trySubscribe = function (subscriber) {
+ this._throwIfClosed();
+ return _super.prototype._trySubscribe.call(this, subscriber);
+ };
+ Subject.prototype._subscribe = function (subscriber) {
+ this._throwIfClosed();
+ this._checkFinalizedStatuses(subscriber);
+ return this._innerSubscribe(subscriber);
+ };
+ Subject.prototype._innerSubscribe = function (subscriber) {
+ var _this = this;
+ var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
+ if (hasError || isStopped) {
+ return EMPTY_SUBSCRIPTION;
+ }
+ this.currentObservers = null;
+ observers.push(subscriber);
+ return new Subscription(function () {
+ _this.currentObservers = null;
+ arrRemove(observers, subscriber);
+ });
+ };
+ Subject.prototype._checkFinalizedStatuses = function (subscriber) {
+ var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
+ if (hasError) {
+ subscriber.error(thrownError);
+ }
+ else if (isStopped) {
+ subscriber.complete();
+ }
+ };
+ Subject.prototype.asObservable = function () {
+ var observable = new Observable();
+ observable.source = this;
+ return observable;
+ };
+ Subject.create = function (destination, source) {
+ return new AnonymousSubject(destination, source);
+ };
+ return Subject;
+}(Observable));
+export { Subject };
+var AnonymousSubject = (function (_super) {
+ __extends(AnonymousSubject, _super);
+ function AnonymousSubject(destination, source) {
+ var _this = _super.call(this) || this;
+ _this.destination = destination;
+ _this.source = source;
+ return _this;
+ }
+ AnonymousSubject.prototype.next = function (value) {
+ var _a, _b;
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
+ };
+ AnonymousSubject.prototype.error = function (err) {
+ var _a, _b;
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
+ };
+ AnonymousSubject.prototype.complete = function () {
+ var _a, _b;
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
+ };
+ AnonymousSubject.prototype._subscribe = function (subscriber) {
+ var _a, _b;
+ return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
+ };
+ return AnonymousSubject;
+}(Subject));
+export { AnonymousSubject };
+//# sourceMappingURL=Subject.js.map \ No newline at end of file
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage