/** PURE_IMPORTS_START tslib,_Subscriber,_Subscription,_Observable,_Subject PURE_IMPORTS_END */ import * as tslib_1 from "tslib"; import { Subscriber } from '../Subscriber'; import { Subscription } from '../Subscription'; import { Observable } from '../Observable'; import { Subject } from '../Subject'; export function groupBy(keySelector, elementSelector, durationSelector, subjectSelector) { return function (source) { return source.lift(new GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector)); }; } var GroupByOperator = /*@__PURE__*/ (function () { function GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector) { this.keySelector = keySelector; this.elementSelector = elementSelector; this.durationSelector = durationSelector; this.subjectSelector = subjectSelector; } GroupByOperator.prototype.call = function (subscriber, source) { return source.subscribe(new GroupBySubscriber(subscriber, this.keySelector, this.elementSelector, this.durationSelector, this.subjectSelector)); }; return GroupByOperator; }()); var GroupBySubscriber = /*@__PURE__*/ (function (_super) { tslib_1.__extends(GroupBySubscriber, _super); function GroupBySubscriber(destination, keySelector, elementSelector, durationSelector, subjectSelector) { var _this = _super.call(this, destination) || this; _this.keySelector = keySelector; _this.elementSelector = elementSelector; _this.durationSelector = durationSelector; _this.subjectSelector = subjectSelector; _this.groups = null; _this.attemptedToUnsubscribe = false; _this.count = 0; return _this; } GroupBySubscriber.prototype._next = function (value) { var key; try { key = this.keySelector(value); } catch (err) { this.error(err); return; } this._group(value, key); }; GroupBySubscriber.prototype._group = function (value, key) { var groups = this.groups; if (!groups) { groups = this.groups = new Map(); } var group = groups.get(key); var element; if (this.elementSelector) { try { element = this.elementSelector(value); } catch (err) { this.error(err); } } else { element = value; } if (!group) { group = (this.subjectSelector ? this.subjectSelector() : new Subject()); groups.set(key, group); var groupedObservable = new GroupedObservable(key, group, this); this.destination.next(groupedObservable); if (this.durationSelector) { var duration = void 0; try { duration = this.durationSelector(new GroupedObservable(key, group)); } catch (err) { this.error(err); return; } this.add(duration.subscribe(new GroupDurationSubscriber(key, group, this))); } } if (!group.closed) { group.next(element); } }; GroupBySubscriber.prototype._error = function (err) { var groups = this.groups; if (groups) { groups.forEach(function (group, key) { group.error(err); }); groups.clear(); } this.destination.error(err); }; GroupBySubscriber.prototype._complete = function () { var groups = this.groups; if (groups) { groups.forEach(function (group, key) { group.complete(); }); groups.clear(); } this.destination.complete(); }; GroupBySubscriber.prototype.removeGroup = function (key) { this.groups.delete(key); }; GroupBySubscriber.prototype.unsubscribe = function () { if (!this.closed) { this.attemptedToUnsubscribe = true; if (this.count === 0) { _super.prototype.unsubscribe.call(this); } } }; return GroupBySubscriber; }(Subscriber)); var GroupDurationSubscriber = /*@__PURE__*/ (function (_super) { tslib_1.__extends(GroupDurationSubscriber, _super); function GroupDurationSubscriber(key, group, parent) { var _this = _super.call(this, group) || this; _this.key = key; _this.group = group; _this.parent = parent; return _this; } GroupDurationSubscriber.prototype._next = function (value) { this.complete(); }; GroupDurationSubscriber.prototype._unsubscribe = function () { var _a = this, parent = _a.parent, key = _a.key; this.key = this.parent = null; if (parent) { parent.removeGroup(key); } }; return GroupDurationSubscriber; }(Subscriber)); var GroupedObservable = /*@__PURE__*/ (function (_super) { tslib_1.__extends(GroupedObservable, _super); function GroupedObservable(key, groupSubject, refCountSubscription) { var _this = _super.call(this) || this; _this.key = key; _this.groupSubject = groupSubject; _this.refCountSubscription = refCountSubscription; return _this; } GroupedObservable.prototype._subscribe = function (subscriber) { var subscription = new Subscription(); var _a = this, refCountSubscription = _a.refCountSubscription, groupSubject = _a.groupSubject; if (refCountSubscription && !refCountSubscription.closed) { subscription.add(new InnerRefCountSubscription(refCountSubscription)); } subscription.add(groupSubject.subscribe(subscriber)); return subscription; }; return GroupedObservable; }(Observable)); export { GroupedObservable }; var InnerRefCountSubscription = /*@__PURE__*/ (function (_super) { tslib_1.__extends(InnerRefCountSubscription, _super); function InnerRefCountSubscription(parent) { var _this = _super.call(this) || this; _this.parent = parent; parent.count++; return _this; } InnerRefCountSubscription.prototype.unsubscribe = function () { var parent = this.parent; if (!parent.closed && !this.closed) { _super.prototype.unsubscribe.call(this); parent.count -= 1; if (parent.count === 0 && parent.attemptedToUnsubscribe) { parent.unsubscribe(); } } }; return InnerRefCountSubscription; }(Subscription)); //# sourceMappingURL=groupBy.js.map
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
audit.js | File | 2.47 KB | 0644 |
|
audit.js.map | File | 1.79 KB | 0644 |
|
auditTime.js | File | 431 B | 0644 |
|
auditTime.js.map | File | 407 B | 0644 |
|
buffer.js | File | 1.4 KB | 0644 |
|
buffer.js.map | File | 1.04 KB | 0644 |
|
bufferCount.js | File | 3.39 KB | 0644 |
|
bufferCount.js.map | File | 2.46 KB | 0644 |
|
bufferTime.js | File | 6.32 KB | 0644 |
|
bufferTime.js.map | File | 5.16 KB | 0644 |
|
bufferToggle.js | File | 4.24 KB | 0644 |
|
bufferToggle.js.map | File | 3.38 KB | 0644 |
|
bufferWhen.js | File | 2.9 KB | 0644 |
|
bufferWhen.js.map | File | 2.09 KB | 0644 |
|
catchError.js | File | 1.83 KB | 0644 |
|
catchError.js.map | File | 1.39 KB | 0644 |
|
combineAll.js | File | 307 B | 0644 |
|
combineAll.js.map | File | 310 B | 0644 |
|
combineLatest.js | File | 855 B | 0644 |
|
combineLatest.js.map | File | 822 B | 0644 |
|
concat.js | File | 431 B | 0644 |
|
concat.js.map | File | 371 B | 0644 |
|
concatAll.js | File | 186 B | 0644 |
|
concatAll.js.map | File | 228 B | 0644 |
|
concatMap.js | File | 234 B | 0644 |
|
concatMap.js.map | File | 272 B | 0644 |
|
concatMapTo.js | File | 279 B | 0644 |
|
concatMapTo.js.map | File | 286 B | 0644 |
|
count.js | File | 1.72 KB | 0644 |
|
count.js.map | File | 1.41 KB | 0644 |
|
debounce.js | File | 2.74 KB | 0644 |
|
debounce.js.map | File | 2.06 KB | 0644 |
|
debounceTime.js | File | 2.43 KB | 0644 |
|
debounceTime.js.map | File | 1.81 KB | 0644 |
|
defaultIfEmpty.js | File | 1.48 KB | 0644 |
|
defaultIfEmpty.js.map | File | 1.02 KB | 0644 |
|
delay.js | File | 3.4 KB | 0644 |
|
delay.js.map | File | 3.04 KB | 0644 |
|
delayWhen.js | File | 5.3 KB | 0644 |
|
delayWhen.js.map | File | 3.7 KB | 0644 |
|
dematerialize.js | File | 1.01 KB | 0644 |
|
dematerialize.js.map | File | 675 B | 0644 |
|
distinct.js | File | 2.25 KB | 0644 |
|
distinct.js.map | File | 1.74 KB | 0644 |
|
distinctUntilChanged.js | File | 2.15 KB | 0644 |
|
distinctUntilChanged.js.map | File | 1.62 KB | 0644 |
|
distinctUntilKeyChanged.js | File | 354 B | 0644 |
|
distinctUntilKeyChanged.js.map | File | 463 B | 0644 |
|
elementAt.js | File | 832 B | 0644 |
|
elementAt.js.map | File | 790 B | 0644 |
|
endWith.js | File | 424 B | 0644 |
|
endWith.js.map | File | 385 B | 0644 |
|
every.js | File | 1.81 KB | 0644 |
|
every.js.map | File | 1.51 KB | 0644 |
|
exhaust.js | File | 1.61 KB | 0644 |
|
exhaust.js.map | File | 1.11 KB | 0644 |
|
exhaustMap.js | File | 2.98 KB | 0644 |
|
exhaustMap.js.map | File | 2.45 KB | 0644 |
|
expand.js | File | 3.74 KB | 0644 |
|
expand.js.map | File | 3.06 KB | 0644 |
|
filter.js | File | 1.45 KB | 0644 |
|
filter.js.map | File | 1.16 KB | 0644 |
|
finalize.js | File | 1.01 KB | 0644 |
|
finalize.js.map | File | 764 B | 0644 |
|
find.js | File | 2.26 KB | 0644 |
|
find.js.map | File | 1.83 KB | 0644 |
|
findIndex.js | File | 313 B | 0644 |
|
findIndex.js.map | File | 350 B | 0644 |
|
first.js | File | 763 B | 0644 |
|
first.js.map | File | 822 B | 0644 |
|
groupBy.js | File | 6.59 KB | 0644 |
|
groupBy.js.map | File | 4.97 KB | 0644 |
|
ignoreElements.js | File | 1019 B | 0644 |
|
ignoreElements.js.map | File | 592 B | 0644 |
|
index.js | File | 4.09 KB | 0644 |
|
index.js.map | File | 4.24 KB | 0644 |
|
isEmpty.js | File | 1.17 KB | 0644 |
|
isEmpty.js.map | File | 858 B | 0644 |
|
last.js | File | 777 B | 0644 |
|
last.js.map | File | 820 B | 0644 |
|
map.js | File | 1.52 KB | 0644 |
|
map.js.map | File | 1.22 KB | 0644 |
|
mapTo.js | File | 1009 B | 0644 |
|
mapTo.js.map | File | 794 B | 0644 |
|
materialize.js | File | 1.46 KB | 0644 |
|
materialize.js.map | File | 1.05 KB | 0644 |
|
max.js | File | 341 B | 0644 |
|
max.js.map | File | 533 B | 0644 |
|
merge.js | File | 424 B | 0644 |
|
merge.js.map | File | 369 B | 0644 |
|
mergeAll.js | File | 359 B | 0644 |
|
mergeAll.js.map | File | 330 B | 0644 |
|
mergeMap.js | File | 3.66 KB | 0644 |
|
mergeMap.js.map | File | 3.03 KB | 0644 |
|
mergeMapTo.js | File | 604 B | 0644 |
|
mergeMapTo.js.map | File | 520 B | 0644 |
|
mergeScan.js | File | 3.5 KB | 0644 |
|
mergeScan.js.map | File | 2.81 KB | 0644 |
|
min.js | File | 341 B | 0644 |
|
min.js.map | File | 533 B | 0644 |
|
multicast.js | File | 1.5 KB | 0644 |
|
multicast.js.map | File | 1.1 KB | 0644 |
|
observeOn.js | File | 2.56 KB | 0644 |
|
observeOn.js.map | File | 1.77 KB | 0644 |
|
onErrorResumeNext.js | File | 3 KB | 0644 |
|
onErrorResumeNext.js.map | File | 2.12 KB | 0644 |
|
pairwise.js | File | 1.17 KB | 0644 |
|
pairwise.js.map | File | 907 B | 0644 |
|
partition.js | File | 385 B | 0644 |
|
partition.js.map | File | 424 B | 0644 |
|
pluck.js | File | 902 B | 0644 |
|
pluck.js.map | File | 929 B | 0644 |
|
publish.js | File | 341 B | 0644 |
|
publish.js.map | File | 384 B | 0644 |
|
publishBehavior.js | File | 341 B | 0644 |
|
publishBehavior.js.map | File | 361 B | 0644 |
|
publishLast.js | File | 311 B | 0644 |
|
publishLast.js.map | File | 333 B | 0644 |
|
publishReplay.js | File | 686 B | 0644 |
|
publishReplay.js.map | File | 649 B | 0644 |
|
race.js | File | 625 B | 0644 |
|
race.js.map | File | 555 B | 0644 |
|
reduce.js | File | 718 B | 0644 |
|
reduce.js.map | File | 790 B | 0644 |
|
refCount.js | File | 2.01 KB | 0644 |
|
refCount.js.map | File | 1.49 KB | 0644 |
|
repeat.js | File | 1.73 KB | 0644 |
|
repeat.js.map | File | 1.35 KB | 0644 |
|
repeatWhen.js | File | 3.2 KB | 0644 |
|
repeatWhen.js.map | File | 2.22 KB | 0644 |
|
retry.js | File | 1.45 KB | 0644 |
|
retry.js.map | File | 1.13 KB | 0644 |
|
retryWhen.js | File | 2.84 KB | 0644 |
|
retryWhen.js.map | File | 2.1 KB | 0644 |
|
sample.js | File | 1.64 KB | 0644 |
|
sample.js.map | File | 1.17 KB | 0644 |
|
sampleTime.js | File | 1.82 KB | 0644 |
|
sampleTime.js.map | File | 1.41 KB | 0644 |
|
scan.js | File | 2.2 KB | 0644 |
|
scan.js.map | File | 1.78 KB | 0644 |
|
sequenceEqual.js | File | 3.91 KB | 0644 |
|
sequenceEqual.js.map | File | 3.05 KB | 0644 |
|
share.js | File | 407 B | 0644 |
|
share.js.map | File | 431 B | 0644 |
|
shareReplay.js | File | 2.09 KB | 0644 |
|
shareReplay.js.map | File | 1.68 KB | 0644 |
|
single.js | File | 2.29 KB | 0644 |
|
single.js.map | File | 1.85 KB | 0644 |
|
skip.js | File | 1.04 KB | 0644 |
|
skip.js.map | File | 849 B | 0644 |
|
skipLast.js | File | 1.81 KB | 0644 |
|
skipLast.js.map | File | 1.42 KB | 0644 |
|
skipUntil.js | File | 1.82 KB | 0644 |
|
skipUntil.js.map | File | 1.28 KB | 0644 |
|
skipWhile.js | File | 1.56 KB | 0644 |
|
skipWhile.js.map | File | 1.22 KB | 0644 |
|
startWith.js | File | 631 B | 0644 |
|
startWith.js.map | File | 615 B | 0644 |
|
subscribeOn.js | File | 829 B | 0644 |
|
subscribeOn.js.map | File | 657 B | 0644 |
|
switchAll.js | File | 257 B | 0644 |
|
switchAll.js.map | File | 271 B | 0644 |
|
switchMap.js | File | 2.95 KB | 0644 |
|
switchMap.js.map | File | 2.34 KB | 0644 |
|
switchMapTo.js | File | 349 B | 0644 |
|
switchMapTo.js.map | File | 361 B | 0644 |
|
take.js | File | 1.58 KB | 0644 |
|
take.js.map | File | 1.23 KB | 0644 |
|
takeLast.js | File | 2.14 KB | 0644 |
|
takeLast.js.map | File | 1.83 KB | 0644 |
|
takeUntil.js | File | 1.53 KB | 0644 |
|
takeUntil.js.map | File | 1.03 KB | 0644 |
|
takeWhile.js | File | 1.9 KB | 0644 |
|
takeWhile.js.map | File | 1.44 KB | 0644 |
|
tap.js | File | 2.56 KB | 0644 |
|
tap.js.map | File | 2.16 KB | 0644 |
|
throttle.js | File | 3.19 KB | 0644 |
|
throttle.js.map | File | 2.41 KB | 0644 |
|
throttleTime.js | File | 3.15 KB | 0644 |
|
throttleTime.js.map | File | 2.44 KB | 0644 |
|
throwIfEmpty.js | File | 1.8 KB | 0644 |
|
throwIfEmpty.js.map | File | 1.26 KB | 0644 |
|
timeInterval.js | File | 1.11 KB | 0644 |
|
timeInterval.js.map | File | 977 B | 0644 |
|
timeout.js | File | 529 B | 0644 |
|
timeout.js.map | File | 445 B | 0644 |
|
timeoutWith.js | File | 2.82 KB | 0644 |
|
timeoutWith.js.map | File | 2.12 KB | 0644 |
|
timestamp.js | File | 574 B | 0644 |
|
timestamp.js.map | File | 509 B | 0644 |
|
toArray.js | File | 325 B | 0644 |
|
toArray.js.map | File | 415 B | 0644 |
|
window.js | File | 2.42 KB | 0644 |
|
window.js.map | File | 1.84 KB | 0644 |
|
windowCount.js | File | 2.96 KB | 0644 |
|
windowCount.js.map | File | 2.55 KB | 0644 |
|
windowTime.js | File | 6.41 KB | 0644 |
|
windowTime.js.map | File | 5.09 KB | 0644 |
|
windowToggle.js | File | 4.96 KB | 0644 |
|
windowToggle.js.map | File | 3.88 KB | 0644 |
|
windowWhen.js | File | 3.04 KB | 0644 |
|
windowWhen.js.map | File | 2.29 KB | 0644 |
|
withLatestFrom.js | File | 2.95 KB | 0644 |
|
withLatestFrom.js.map | File | 2.44 KB | 0644 |
|
zip.js | File | 441 B | 0644 |
|
zip.js.map | File | 381 B | 0644 |
|
zipAll.js | File | 259 B | 0644 |
|
zipAll.js.map | File | 297 B | 0644 |
|