mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-08-06 20:48:35 +00:00
update
This commit is contained in:
43
node_modules/rxjs/operators/audit.d.ts
generated
vendored
Normal file
43
node_modules/rxjs/operators/audit.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import { SubscribableOrPromise } from '../Observable';
|
||||
import { MonoTypeOperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* Ignores source values for a duration determined by another Observable, then
|
||||
* emits the most recent value from the source Observable, then repeats this
|
||||
* process.
|
||||
*
|
||||
* <span class="informal">It's like {@link auditTime}, but the silencing
|
||||
* duration is determined by a second Observable.</span>
|
||||
*
|
||||
* <img src="./img/audit.png" width="100%">
|
||||
*
|
||||
* `audit` is similar to `throttle`, but emits the last value from the silenced
|
||||
* time window, instead of the first value. `audit` emits the most recent value
|
||||
* from the source Observable on the output Observable as soon as its internal
|
||||
* timer becomes disabled, and ignores source values while the timer is enabled.
|
||||
* Initially, the timer is disabled. As soon as the first source value arrives,
|
||||
* the timer is enabled by calling the `durationSelector` function with the
|
||||
* source value, which returns the "duration" Observable. When the duration
|
||||
* Observable emits a value or completes, the timer is disabled, then the most
|
||||
* recent source value is emitted on the output Observable, and this process
|
||||
* repeats for the next source value.
|
||||
*
|
||||
* @example <caption>Emit clicks at a rate of at most one click per second</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var result = clicks.audit(ev => Rx.Observable.interval(1000));
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link auditTime}
|
||||
* @see {@link debounce}
|
||||
* @see {@link delayWhen}
|
||||
* @see {@link sample}
|
||||
* @see {@link throttle}
|
||||
*
|
||||
* @param {function(value: T): SubscribableOrPromise} durationSelector A function
|
||||
* that receives a value from the source Observable, for computing the silencing
|
||||
* duration, returned as an Observable or a Promise.
|
||||
* @return {Observable<T>} An Observable that performs rate-limiting of
|
||||
* emissions from the source Observable.
|
||||
* @method audit
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function audit<T>(durationSelector: (value: T) => SubscribableOrPromise<any>): MonoTypeOperatorFunction<T>;
|
118
node_modules/rxjs/operators/audit.js
generated
vendored
Normal file
118
node_modules/rxjs/operators/audit.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var tryCatch_1 = require('../util/tryCatch');
|
||||
var errorObject_1 = require('../util/errorObject');
|
||||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||||
/**
|
||||
* Ignores source values for a duration determined by another Observable, then
|
||||
* emits the most recent value from the source Observable, then repeats this
|
||||
* process.
|
||||
*
|
||||
* <span class="informal">It's like {@link auditTime}, but the silencing
|
||||
* duration is determined by a second Observable.</span>
|
||||
*
|
||||
* <img src="./img/audit.png" width="100%">
|
||||
*
|
||||
* `audit` is similar to `throttle`, but emits the last value from the silenced
|
||||
* time window, instead of the first value. `audit` emits the most recent value
|
||||
* from the source Observable on the output Observable as soon as its internal
|
||||
* timer becomes disabled, and ignores source values while the timer is enabled.
|
||||
* Initially, the timer is disabled. As soon as the first source value arrives,
|
||||
* the timer is enabled by calling the `durationSelector` function with the
|
||||
* source value, which returns the "duration" Observable. When the duration
|
||||
* Observable emits a value or completes, the timer is disabled, then the most
|
||||
* recent source value is emitted on the output Observable, and this process
|
||||
* repeats for the next source value.
|
||||
*
|
||||
* @example <caption>Emit clicks at a rate of at most one click per second</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var result = clicks.audit(ev => Rx.Observable.interval(1000));
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link auditTime}
|
||||
* @see {@link debounce}
|
||||
* @see {@link delayWhen}
|
||||
* @see {@link sample}
|
||||
* @see {@link throttle}
|
||||
*
|
||||
* @param {function(value: T): SubscribableOrPromise} durationSelector A function
|
||||
* that receives a value from the source Observable, for computing the silencing
|
||||
* duration, returned as an Observable or a Promise.
|
||||
* @return {Observable<T>} An Observable that performs rate-limiting of
|
||||
* emissions from the source Observable.
|
||||
* @method audit
|
||||
* @owner Observable
|
||||
*/
|
||||
function audit(durationSelector) {
|
||||
return function auditOperatorFunction(source) {
|
||||
return source.lift(new AuditOperator(durationSelector));
|
||||
};
|
||||
}
|
||||
exports.audit = audit;
|
||||
var AuditOperator = (function () {
|
||||
function AuditOperator(durationSelector) {
|
||||
this.durationSelector = durationSelector;
|
||||
}
|
||||
AuditOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new AuditSubscriber(subscriber, this.durationSelector));
|
||||
};
|
||||
return AuditOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var AuditSubscriber = (function (_super) {
|
||||
__extends(AuditSubscriber, _super);
|
||||
function AuditSubscriber(destination, durationSelector) {
|
||||
_super.call(this, destination);
|
||||
this.durationSelector = durationSelector;
|
||||
this.hasValue = false;
|
||||
}
|
||||
AuditSubscriber.prototype._next = function (value) {
|
||||
this.value = value;
|
||||
this.hasValue = true;
|
||||
if (!this.throttled) {
|
||||
var duration = tryCatch_1.tryCatch(this.durationSelector)(value);
|
||||
if (duration === errorObject_1.errorObject) {
|
||||
this.destination.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
else {
|
||||
var innerSubscription = subscribeToResult_1.subscribeToResult(this, duration);
|
||||
if (innerSubscription.closed) {
|
||||
this.clearThrottle();
|
||||
}
|
||||
else {
|
||||
this.add(this.throttled = innerSubscription);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
AuditSubscriber.prototype.clearThrottle = function () {
|
||||
var _a = this, value = _a.value, hasValue = _a.hasValue, throttled = _a.throttled;
|
||||
if (throttled) {
|
||||
this.remove(throttled);
|
||||
this.throttled = null;
|
||||
throttled.unsubscribe();
|
||||
}
|
||||
if (hasValue) {
|
||||
this.value = null;
|
||||
this.hasValue = false;
|
||||
this.destination.next(value);
|
||||
}
|
||||
};
|
||||
AuditSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex) {
|
||||
this.clearThrottle();
|
||||
};
|
||||
AuditSubscriber.prototype.notifyComplete = function () {
|
||||
this.clearThrottle();
|
||||
};
|
||||
return AuditSubscriber;
|
||||
}(OuterSubscriber_1.OuterSubscriber));
|
||||
//# sourceMappingURL=audit.js.map
|
1
node_modules/rxjs/operators/audit.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/audit.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
45
node_modules/rxjs/operators/auditTime.d.ts
generated
vendored
Normal file
45
node_modules/rxjs/operators/auditTime.d.ts
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { MonoTypeOperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* Ignores source values for `duration` milliseconds, then emits the most recent
|
||||
* value from the source Observable, then repeats this process.
|
||||
*
|
||||
* <span class="informal">When it sees a source values, it ignores that plus
|
||||
* the next ones for `duration` milliseconds, and then it emits the most recent
|
||||
* value from the source.</span>
|
||||
*
|
||||
* <img src="./img/auditTime.png" width="100%">
|
||||
*
|
||||
* `auditTime` is similar to `throttleTime`, but emits the last value from the
|
||||
* silenced time window, instead of the first value. `auditTime` emits the most
|
||||
* recent value from the source Observable on the output Observable as soon as
|
||||
* its internal timer becomes disabled, and ignores source values while the
|
||||
* timer is enabled. Initially, the timer is disabled. As soon as the first
|
||||
* source value arrives, the timer is enabled. After `duration` milliseconds (or
|
||||
* the time unit determined internally by the optional `scheduler`) has passed,
|
||||
* the timer is disabled, then the most recent source value is emitted on the
|
||||
* output Observable, and this process repeats for the next source value.
|
||||
* Optionally takes a {@link IScheduler} for managing timers.
|
||||
*
|
||||
* @example <caption>Emit clicks at a rate of at most one click per second</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var result = clicks.auditTime(1000);
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link audit}
|
||||
* @see {@link debounceTime}
|
||||
* @see {@link delay}
|
||||
* @see {@link sampleTime}
|
||||
* @see {@link throttleTime}
|
||||
*
|
||||
* @param {number} duration Time to wait before emitting the most recent source
|
||||
* value, measured in milliseconds or the time unit determined internally
|
||||
* by the optional `scheduler`.
|
||||
* @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for
|
||||
* managing the timers that handle the rate-limiting behavior.
|
||||
* @return {Observable<T>} An Observable that performs rate-limiting of
|
||||
* emissions from the source Observable.
|
||||
* @method auditTime
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function auditTime<T>(duration: number, scheduler?: IScheduler): MonoTypeOperatorFunction<T>;
|
52
node_modules/rxjs/operators/auditTime.js
generated
vendored
Normal file
52
node_modules/rxjs/operators/auditTime.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
var async_1 = require('../scheduler/async');
|
||||
var audit_1 = require('./audit');
|
||||
var timer_1 = require('../observable/timer');
|
||||
/**
|
||||
* Ignores source values for `duration` milliseconds, then emits the most recent
|
||||
* value from the source Observable, then repeats this process.
|
||||
*
|
||||
* <span class="informal">When it sees a source values, it ignores that plus
|
||||
* the next ones for `duration` milliseconds, and then it emits the most recent
|
||||
* value from the source.</span>
|
||||
*
|
||||
* <img src="./img/auditTime.png" width="100%">
|
||||
*
|
||||
* `auditTime` is similar to `throttleTime`, but emits the last value from the
|
||||
* silenced time window, instead of the first value. `auditTime` emits the most
|
||||
* recent value from the source Observable on the output Observable as soon as
|
||||
* its internal timer becomes disabled, and ignores source values while the
|
||||
* timer is enabled. Initially, the timer is disabled. As soon as the first
|
||||
* source value arrives, the timer is enabled. After `duration` milliseconds (or
|
||||
* the time unit determined internally by the optional `scheduler`) has passed,
|
||||
* the timer is disabled, then the most recent source value is emitted on the
|
||||
* output Observable, and this process repeats for the next source value.
|
||||
* Optionally takes a {@link IScheduler} for managing timers.
|
||||
*
|
||||
* @example <caption>Emit clicks at a rate of at most one click per second</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var result = clicks.auditTime(1000);
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link audit}
|
||||
* @see {@link debounceTime}
|
||||
* @see {@link delay}
|
||||
* @see {@link sampleTime}
|
||||
* @see {@link throttleTime}
|
||||
*
|
||||
* @param {number} duration Time to wait before emitting the most recent source
|
||||
* value, measured in milliseconds or the time unit determined internally
|
||||
* by the optional `scheduler`.
|
||||
* @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for
|
||||
* managing the timers that handle the rate-limiting behavior.
|
||||
* @return {Observable<T>} An Observable that performs rate-limiting of
|
||||
* emissions from the source Observable.
|
||||
* @method auditTime
|
||||
* @owner Observable
|
||||
*/
|
||||
function auditTime(duration, scheduler) {
|
||||
if (scheduler === void 0) { scheduler = async_1.async; }
|
||||
return audit_1.audit(function () { return timer_1.timer(duration, scheduler); });
|
||||
}
|
||||
exports.auditTime = auditTime;
|
||||
//# sourceMappingURL=auditTime.js.map
|
1
node_modules/rxjs/operators/auditTime.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/auditTime.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"auditTime.js","sourceRoot":"","sources":["../../src/operators/auditTime.ts"],"names":[],"mappings":";AAAA,sBAAsB,oBAAoB,CAAC,CAAA;AAE3C,sBAAsB,SAAS,CAAC,CAAA;AAChC,sBAAsB,qBAAqB,CAAC,CAAA;AAG5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,mBAA6B,QAAgB,EAAE,SAA6B;IAA7B,yBAA6B,GAA7B,yBAA6B;IAC1E,MAAM,CAAC,aAAK,CAAC,cAAM,OAAA,aAAK,CAAC,QAAQ,EAAE,SAAS,CAAC,EAA1B,CAA0B,CAAC,CAAC;AACjD,CAAC;AAFe,iBAAS,YAExB,CAAA","sourcesContent":["import { async } from '../scheduler/async';\nimport { IScheduler } from '../Scheduler';\nimport { audit } from './audit';\nimport { timer } from '../observable/timer';\nimport { MonoTypeOperatorFunction } from '../interfaces';\n\n/**\n * Ignores source values for `duration` milliseconds, then emits the most recent\n * value from the source Observable, then repeats this process.\n *\n * <span class=\"informal\">When it sees a source values, it ignores that plus\n * the next ones for `duration` milliseconds, and then it emits the most recent\n * value from the source.</span>\n *\n * <img src=\"./img/auditTime.png\" width=\"100%\">\n *\n * `auditTime` is similar to `throttleTime`, but emits the last value from the\n * silenced time window, instead of the first value. `auditTime` emits the most\n * recent value from the source Observable on the output Observable as soon as\n * its internal timer becomes disabled, and ignores source values while the\n * timer is enabled. Initially, the timer is disabled. As soon as the first\n * source value arrives, the timer is enabled. After `duration` milliseconds (or\n * the time unit determined internally by the optional `scheduler`) has passed,\n * the timer is disabled, then the most recent source value is emitted on the\n * output Observable, and this process repeats for the next source value.\n * Optionally takes a {@link IScheduler} for managing timers.\n *\n * @example <caption>Emit clicks at a rate of at most one click per second</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.auditTime(1000);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link audit}\n * @see {@link debounceTime}\n * @see {@link delay}\n * @see {@link sampleTime}\n * @see {@link throttleTime}\n *\n * @param {number} duration Time to wait before emitting the most recent source\n * value, measured in milliseconds or the time unit determined internally\n * by the optional `scheduler`.\n * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for\n * managing the timers that handle the rate-limiting behavior.\n * @return {Observable<T>} An Observable that performs rate-limiting of\n * emissions from the source Observable.\n * @method auditTime\n * @owner Observable\n */\nexport function auditTime<T>(duration: number, scheduler: IScheduler = async): MonoTypeOperatorFunction<T> {\n return audit(() => timer(duration, scheduler));\n}\n"]}
|
35
node_modules/rxjs/operators/buffer.d.ts
generated
vendored
Normal file
35
node_modules/rxjs/operators/buffer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { OperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* Buffers the source Observable values until `closingNotifier` emits.
|
||||
*
|
||||
* <span class="informal">Collects values from the past as an array, and emits
|
||||
* that array only when another Observable emits.</span>
|
||||
*
|
||||
* <img src="./img/buffer.png" width="100%">
|
||||
*
|
||||
* Buffers the incoming Observable values until the given `closingNotifier`
|
||||
* Observable emits a value, at which point it emits the buffer on the output
|
||||
* Observable and starts a new buffer internally, awaiting the next time
|
||||
* `closingNotifier` emits.
|
||||
*
|
||||
* @example <caption>On every click, emit array of most recent interval events</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var interval = Rx.Observable.interval(1000);
|
||||
* var buffered = interval.buffer(clicks);
|
||||
* buffered.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link bufferCount}
|
||||
* @see {@link bufferTime}
|
||||
* @see {@link bufferToggle}
|
||||
* @see {@link bufferWhen}
|
||||
* @see {@link window}
|
||||
*
|
||||
* @param {Observable<any>} closingNotifier An Observable that signals the
|
||||
* buffer to be emitted on the output Observable.
|
||||
* @return {Observable<T[]>} An Observable of buffers, which are arrays of
|
||||
* values.
|
||||
* @method buffer
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function buffer<T>(closingNotifier: Observable<any>): OperatorFunction<T, T[]>;
|
78
node_modules/rxjs/operators/buffer.js
generated
vendored
Normal file
78
node_modules/rxjs/operators/buffer.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||||
/**
|
||||
* Buffers the source Observable values until `closingNotifier` emits.
|
||||
*
|
||||
* <span class="informal">Collects values from the past as an array, and emits
|
||||
* that array only when another Observable emits.</span>
|
||||
*
|
||||
* <img src="./img/buffer.png" width="100%">
|
||||
*
|
||||
* Buffers the incoming Observable values until the given `closingNotifier`
|
||||
* Observable emits a value, at which point it emits the buffer on the output
|
||||
* Observable and starts a new buffer internally, awaiting the next time
|
||||
* `closingNotifier` emits.
|
||||
*
|
||||
* @example <caption>On every click, emit array of most recent interval events</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var interval = Rx.Observable.interval(1000);
|
||||
* var buffered = interval.buffer(clicks);
|
||||
* buffered.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link bufferCount}
|
||||
* @see {@link bufferTime}
|
||||
* @see {@link bufferToggle}
|
||||
* @see {@link bufferWhen}
|
||||
* @see {@link window}
|
||||
*
|
||||
* @param {Observable<any>} closingNotifier An Observable that signals the
|
||||
* buffer to be emitted on the output Observable.
|
||||
* @return {Observable<T[]>} An Observable of buffers, which are arrays of
|
||||
* values.
|
||||
* @method buffer
|
||||
* @owner Observable
|
||||
*/
|
||||
function buffer(closingNotifier) {
|
||||
return function bufferOperatorFunction(source) {
|
||||
return source.lift(new BufferOperator(closingNotifier));
|
||||
};
|
||||
}
|
||||
exports.buffer = buffer;
|
||||
var BufferOperator = (function () {
|
||||
function BufferOperator(closingNotifier) {
|
||||
this.closingNotifier = closingNotifier;
|
||||
}
|
||||
BufferOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new BufferSubscriber(subscriber, this.closingNotifier));
|
||||
};
|
||||
return BufferOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var BufferSubscriber = (function (_super) {
|
||||
__extends(BufferSubscriber, _super);
|
||||
function BufferSubscriber(destination, closingNotifier) {
|
||||
_super.call(this, destination);
|
||||
this.buffer = [];
|
||||
this.add(subscribeToResult_1.subscribeToResult(this, closingNotifier));
|
||||
}
|
||||
BufferSubscriber.prototype._next = function (value) {
|
||||
this.buffer.push(value);
|
||||
};
|
||||
BufferSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
|
||||
var buffer = this.buffer;
|
||||
this.buffer = [];
|
||||
this.destination.next(buffer);
|
||||
};
|
||||
return BufferSubscriber;
|
||||
}(OuterSubscriber_1.OuterSubscriber));
|
||||
//# sourceMappingURL=buffer.js.map
|
1
node_modules/rxjs/operators/buffer.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/buffer.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"buffer.js","sourceRoot":"","sources":["../../src/operators/buffer.ts"],"names":[],"mappings":";;;;;;AAGA,gCAAgC,oBAAoB,CAAC,CAAA;AAErD,kCAAkC,2BAA2B,CAAC,CAAA;AAG9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,gBAA0B,eAAgC;IACxD,MAAM,CAAC,gCAAgC,MAAqB;QAC1D,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,cAAc,CAAI,eAAe,CAAC,CAAC,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC;AAJe,cAAM,SAIrB,CAAA;AAED;IAEE,wBAAoB,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IACpD,CAAC;IAED,6BAAI,GAAJ,UAAK,UAA2B,EAAE,MAAW;QAC3C,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;IAClF,CAAC;IACH,qBAAC;AAAD,CAAC,AARD,IAQC;AAED;;;;GAIG;AACH;IAAkC,oCAAuB;IAGvD,0BAAY,WAA4B,EAAE,eAAgC;QACxE,kBAAM,WAAW,CAAC,CAAC;QAHb,WAAM,GAAQ,EAAE,CAAC;QAIvB,IAAI,CAAC,GAAG,CAAC,qCAAiB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC;IACrD,CAAC;IAES,gCAAK,GAAf,UAAgB,KAAQ;QACtB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED,qCAAU,GAAV,UAAW,UAAa,EAAE,UAAe,EAC9B,UAAkB,EAAE,UAAkB,EACtC,QAAiC;QAC1C,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IACH,uBAAC;AAAD,CAAC,AAnBD,CAAkC,iCAAe,GAmBhD","sourcesContent":["import { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { Observable } from '../Observable';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { InnerSubscriber } from '../InnerSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nimport { OperatorFunction } from '../interfaces';\n\n/**\n * Buffers the source Observable values until `closingNotifier` emits.\n *\n * <span class=\"informal\">Collects values from the past as an array, and emits\n * that array only when another Observable emits.</span>\n *\n * <img src=\"./img/buffer.png\" width=\"100%\">\n *\n * Buffers the incoming Observable values until the given `closingNotifier`\n * Observable emits a value, at which point it emits the buffer on the output\n * Observable and starts a new buffer internally, awaiting the next time\n * `closingNotifier` emits.\n *\n * @example <caption>On every click, emit array of most recent interval events</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var interval = Rx.Observable.interval(1000);\n * var buffered = interval.buffer(clicks);\n * buffered.subscribe(x => console.log(x));\n *\n * @see {@link bufferCount}\n * @see {@link bufferTime}\n * @see {@link bufferToggle}\n * @see {@link bufferWhen}\n * @see {@link window}\n *\n * @param {Observable<any>} closingNotifier An Observable that signals the\n * buffer to be emitted on the output Observable.\n * @return {Observable<T[]>} An Observable of buffers, which are arrays of\n * values.\n * @method buffer\n * @owner Observable\n */\nexport function buffer<T>(closingNotifier: Observable<any>): OperatorFunction<T, T[]> {\n return function bufferOperatorFunction(source: Observable<T>) {\n return source.lift(new BufferOperator<T>(closingNotifier));\n };\n}\n\nclass BufferOperator<T> implements Operator<T, T[]> {\n\n constructor(private closingNotifier: Observable<any>) {\n }\n\n call(subscriber: Subscriber<T[]>, source: any): any {\n return source.subscribe(new BufferSubscriber(subscriber, this.closingNotifier));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass BufferSubscriber<T> extends OuterSubscriber<T, any> {\n private buffer: T[] = [];\n\n constructor(destination: Subscriber<T[]>, closingNotifier: Observable<any>) {\n super(destination);\n this.add(subscribeToResult(this, closingNotifier));\n }\n\n protected _next(value: T) {\n this.buffer.push(value);\n }\n\n notifyNext(outerValue: T, innerValue: any,\n outerIndex: number, innerIndex: number,\n innerSub: InnerSubscriber<T, any>): void {\n const buffer = this.buffer;\n this.buffer = [];\n this.destination.next(buffer);\n }\n}\n"]}
|
43
node_modules/rxjs/operators/bufferCount.d.ts
generated
vendored
Normal file
43
node_modules/rxjs/operators/bufferCount.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import { OperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* Buffers the source Observable values until the size hits the maximum
|
||||
* `bufferSize` given.
|
||||
*
|
||||
* <span class="informal">Collects values from the past as an array, and emits
|
||||
* that array only when its size reaches `bufferSize`.</span>
|
||||
*
|
||||
* <img src="./img/bufferCount.png" width="100%">
|
||||
*
|
||||
* Buffers a number of values from the source Observable by `bufferSize` then
|
||||
* emits the buffer and clears it, and starts a new buffer each
|
||||
* `startBufferEvery` values. If `startBufferEvery` is not provided or is
|
||||
* `null`, then new buffers are started immediately at the start of the source
|
||||
* and when each buffer closes and is emitted.
|
||||
*
|
||||
* @example <caption>Emit the last two click events as an array</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var buffered = clicks.bufferCount(2);
|
||||
* buffered.subscribe(x => console.log(x));
|
||||
*
|
||||
* @example <caption>On every click, emit the last two click events as an array</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var buffered = clicks.bufferCount(2, 1);
|
||||
* buffered.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link buffer}
|
||||
* @see {@link bufferTime}
|
||||
* @see {@link bufferToggle}
|
||||
* @see {@link bufferWhen}
|
||||
* @see {@link pairwise}
|
||||
* @see {@link windowCount}
|
||||
*
|
||||
* @param {number} bufferSize The maximum size of the buffer emitted.
|
||||
* @param {number} [startBufferEvery] Interval at which to start a new buffer.
|
||||
* For example if `startBufferEvery` is `2`, then a new buffer will be started
|
||||
* on every other value from the source. A new buffer is started at the
|
||||
* beginning of the source by default.
|
||||
* @return {Observable<T[]>} An Observable of arrays of buffered values.
|
||||
* @method bufferCount
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function bufferCount<T>(bufferSize: number, startBufferEvery?: number): OperatorFunction<T, T[]>;
|
142
node_modules/rxjs/operators/bufferCount.js
generated
vendored
Normal file
142
node_modules/rxjs/operators/bufferCount.js
generated
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Subscriber_1 = require('../Subscriber');
|
||||
/**
|
||||
* Buffers the source Observable values until the size hits the maximum
|
||||
* `bufferSize` given.
|
||||
*
|
||||
* <span class="informal">Collects values from the past as an array, and emits
|
||||
* that array only when its size reaches `bufferSize`.</span>
|
||||
*
|
||||
* <img src="./img/bufferCount.png" width="100%">
|
||||
*
|
||||
* Buffers a number of values from the source Observable by `bufferSize` then
|
||||
* emits the buffer and clears it, and starts a new buffer each
|
||||
* `startBufferEvery` values. If `startBufferEvery` is not provided or is
|
||||
* `null`, then new buffers are started immediately at the start of the source
|
||||
* and when each buffer closes and is emitted.
|
||||
*
|
||||
* @example <caption>Emit the last two click events as an array</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var buffered = clicks.bufferCount(2);
|
||||
* buffered.subscribe(x => console.log(x));
|
||||
*
|
||||
* @example <caption>On every click, emit the last two click events as an array</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var buffered = clicks.bufferCount(2, 1);
|
||||
* buffered.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link buffer}
|
||||
* @see {@link bufferTime}
|
||||
* @see {@link bufferToggle}
|
||||
* @see {@link bufferWhen}
|
||||
* @see {@link pairwise}
|
||||
* @see {@link windowCount}
|
||||
*
|
||||
* @param {number} bufferSize The maximum size of the buffer emitted.
|
||||
* @param {number} [startBufferEvery] Interval at which to start a new buffer.
|
||||
* For example if `startBufferEvery` is `2`, then a new buffer will be started
|
||||
* on every other value from the source. A new buffer is started at the
|
||||
* beginning of the source by default.
|
||||
* @return {Observable<T[]>} An Observable of arrays of buffered values.
|
||||
* @method bufferCount
|
||||
* @owner Observable
|
||||
*/
|
||||
function bufferCount(bufferSize, startBufferEvery) {
|
||||
if (startBufferEvery === void 0) { startBufferEvery = null; }
|
||||
return function bufferCountOperatorFunction(source) {
|
||||
return source.lift(new BufferCountOperator(bufferSize, startBufferEvery));
|
||||
};
|
||||
}
|
||||
exports.bufferCount = bufferCount;
|
||||
var BufferCountOperator = (function () {
|
||||
function BufferCountOperator(bufferSize, startBufferEvery) {
|
||||
this.bufferSize = bufferSize;
|
||||
this.startBufferEvery = startBufferEvery;
|
||||
if (!startBufferEvery || bufferSize === startBufferEvery) {
|
||||
this.subscriberClass = BufferCountSubscriber;
|
||||
}
|
||||
else {
|
||||
this.subscriberClass = BufferSkipCountSubscriber;
|
||||
}
|
||||
}
|
||||
BufferCountOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new this.subscriberClass(subscriber, this.bufferSize, this.startBufferEvery));
|
||||
};
|
||||
return BufferCountOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var BufferCountSubscriber = (function (_super) {
|
||||
__extends(BufferCountSubscriber, _super);
|
||||
function BufferCountSubscriber(destination, bufferSize) {
|
||||
_super.call(this, destination);
|
||||
this.bufferSize = bufferSize;
|
||||
this.buffer = [];
|
||||
}
|
||||
BufferCountSubscriber.prototype._next = function (value) {
|
||||
var buffer = this.buffer;
|
||||
buffer.push(value);
|
||||
if (buffer.length == this.bufferSize) {
|
||||
this.destination.next(buffer);
|
||||
this.buffer = [];
|
||||
}
|
||||
};
|
||||
BufferCountSubscriber.prototype._complete = function () {
|
||||
var buffer = this.buffer;
|
||||
if (buffer.length > 0) {
|
||||
this.destination.next(buffer);
|
||||
}
|
||||
_super.prototype._complete.call(this);
|
||||
};
|
||||
return BufferCountSubscriber;
|
||||
}(Subscriber_1.Subscriber));
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var BufferSkipCountSubscriber = (function (_super) {
|
||||
__extends(BufferSkipCountSubscriber, _super);
|
||||
function BufferSkipCountSubscriber(destination, bufferSize, startBufferEvery) {
|
||||
_super.call(this, destination);
|
||||
this.bufferSize = bufferSize;
|
||||
this.startBufferEvery = startBufferEvery;
|
||||
this.buffers = [];
|
||||
this.count = 0;
|
||||
}
|
||||
BufferSkipCountSubscriber.prototype._next = function (value) {
|
||||
var _a = this, bufferSize = _a.bufferSize, startBufferEvery = _a.startBufferEvery, buffers = _a.buffers, count = _a.count;
|
||||
this.count++;
|
||||
if (count % startBufferEvery === 0) {
|
||||
buffers.push([]);
|
||||
}
|
||||
for (var i = buffers.length; i--;) {
|
||||
var buffer = buffers[i];
|
||||
buffer.push(value);
|
||||
if (buffer.length === bufferSize) {
|
||||
buffers.splice(i, 1);
|
||||
this.destination.next(buffer);
|
||||
}
|
||||
}
|
||||
};
|
||||
BufferSkipCountSubscriber.prototype._complete = function () {
|
||||
var _a = this, buffers = _a.buffers, destination = _a.destination;
|
||||
while (buffers.length > 0) {
|
||||
var buffer = buffers.shift();
|
||||
if (buffer.length > 0) {
|
||||
destination.next(buffer);
|
||||
}
|
||||
}
|
||||
_super.prototype._complete.call(this);
|
||||
};
|
||||
return BufferSkipCountSubscriber;
|
||||
}(Subscriber_1.Subscriber));
|
||||
//# sourceMappingURL=bufferCount.js.map
|
1
node_modules/rxjs/operators/bufferCount.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/bufferCount.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
5
node_modules/rxjs/operators/bufferTime.d.ts
generated
vendored
Normal file
5
node_modules/rxjs/operators/bufferTime.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { OperatorFunction } from '../interfaces';
|
||||
export declare function bufferTime<T>(bufferTimeSpan: number, scheduler?: IScheduler): OperatorFunction<T, T[]>;
|
||||
export declare function bufferTime<T>(bufferTimeSpan: number, bufferCreationInterval: number, scheduler?: IScheduler): OperatorFunction<T, T[]>;
|
||||
export declare function bufferTime<T>(bufferTimeSpan: number, bufferCreationInterval: number, maxBufferSize: number, scheduler?: IScheduler): OperatorFunction<T, T[]>;
|
201
node_modules/rxjs/operators/bufferTime.js
generated
vendored
Normal file
201
node_modules/rxjs/operators/bufferTime.js
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var async_1 = require('../scheduler/async');
|
||||
var Subscriber_1 = require('../Subscriber');
|
||||
var isScheduler_1 = require('../util/isScheduler');
|
||||
/* tslint:enable:max-line-length */
|
||||
/**
|
||||
* Buffers the source Observable values for a specific time period.
|
||||
*
|
||||
* <span class="informal">Collects values from the past as an array, and emits
|
||||
* those arrays periodically in time.</span>
|
||||
*
|
||||
* <img src="./img/bufferTime.png" width="100%">
|
||||
*
|
||||
* Buffers values from the source for a specific time duration `bufferTimeSpan`.
|
||||
* Unless the optional argument `bufferCreationInterval` is given, it emits and
|
||||
* resets the buffer every `bufferTimeSpan` milliseconds. If
|
||||
* `bufferCreationInterval` is given, this operator opens the buffer every
|
||||
* `bufferCreationInterval` milliseconds and closes (emits and resets) the
|
||||
* buffer every `bufferTimeSpan` milliseconds. When the optional argument
|
||||
* `maxBufferSize` is specified, the buffer will be closed either after
|
||||
* `bufferTimeSpan` milliseconds or when it contains `maxBufferSize` elements.
|
||||
*
|
||||
* @example <caption>Every second, emit an array of the recent click events</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var buffered = clicks.bufferTime(1000);
|
||||
* buffered.subscribe(x => console.log(x));
|
||||
*
|
||||
* @example <caption>Every 5 seconds, emit the click events from the next 2 seconds</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var buffered = clicks.bufferTime(2000, 5000);
|
||||
* buffered.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link buffer}
|
||||
* @see {@link bufferCount}
|
||||
* @see {@link bufferToggle}
|
||||
* @see {@link bufferWhen}
|
||||
* @see {@link windowTime}
|
||||
*
|
||||
* @param {number} bufferTimeSpan The amount of time to fill each buffer array.
|
||||
* @param {number} [bufferCreationInterval] The interval at which to start new
|
||||
* buffers.
|
||||
* @param {number} [maxBufferSize] The maximum buffer size.
|
||||
* @param {Scheduler} [scheduler=async] The scheduler on which to schedule the
|
||||
* intervals that determine buffer boundaries.
|
||||
* @return {Observable<T[]>} An observable of arrays of buffered values.
|
||||
* @method bufferTime
|
||||
* @owner Observable
|
||||
*/
|
||||
function bufferTime(bufferTimeSpan) {
|
||||
var length = arguments.length;
|
||||
var scheduler = async_1.async;
|
||||
if (isScheduler_1.isScheduler(arguments[arguments.length - 1])) {
|
||||
scheduler = arguments[arguments.length - 1];
|
||||
length--;
|
||||
}
|
||||
var bufferCreationInterval = null;
|
||||
if (length >= 2) {
|
||||
bufferCreationInterval = arguments[1];
|
||||
}
|
||||
var maxBufferSize = Number.POSITIVE_INFINITY;
|
||||
if (length >= 3) {
|
||||
maxBufferSize = arguments[2];
|
||||
}
|
||||
return function bufferTimeOperatorFunction(source) {
|
||||
return source.lift(new BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler));
|
||||
};
|
||||
}
|
||||
exports.bufferTime = bufferTime;
|
||||
var BufferTimeOperator = (function () {
|
||||
function BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) {
|
||||
this.bufferTimeSpan = bufferTimeSpan;
|
||||
this.bufferCreationInterval = bufferCreationInterval;
|
||||
this.maxBufferSize = maxBufferSize;
|
||||
this.scheduler = scheduler;
|
||||
}
|
||||
BufferTimeOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new BufferTimeSubscriber(subscriber, this.bufferTimeSpan, this.bufferCreationInterval, this.maxBufferSize, this.scheduler));
|
||||
};
|
||||
return BufferTimeOperator;
|
||||
}());
|
||||
var Context = (function () {
|
||||
function Context() {
|
||||
this.buffer = [];
|
||||
}
|
||||
return Context;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var BufferTimeSubscriber = (function (_super) {
|
||||
__extends(BufferTimeSubscriber, _super);
|
||||
function BufferTimeSubscriber(destination, bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) {
|
||||
_super.call(this, destination);
|
||||
this.bufferTimeSpan = bufferTimeSpan;
|
||||
this.bufferCreationInterval = bufferCreationInterval;
|
||||
this.maxBufferSize = maxBufferSize;
|
||||
this.scheduler = scheduler;
|
||||
this.contexts = [];
|
||||
var context = this.openContext();
|
||||
this.timespanOnly = bufferCreationInterval == null || bufferCreationInterval < 0;
|
||||
if (this.timespanOnly) {
|
||||
var timeSpanOnlyState = { subscriber: this, context: context, bufferTimeSpan: bufferTimeSpan };
|
||||
this.add(context.closeAction = scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState));
|
||||
}
|
||||
else {
|
||||
var closeState = { subscriber: this, context: context };
|
||||
var creationState = { bufferTimeSpan: bufferTimeSpan, bufferCreationInterval: bufferCreationInterval, subscriber: this, scheduler: scheduler };
|
||||
this.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, closeState));
|
||||
this.add(scheduler.schedule(dispatchBufferCreation, bufferCreationInterval, creationState));
|
||||
}
|
||||
}
|
||||
BufferTimeSubscriber.prototype._next = function (value) {
|
||||
var contexts = this.contexts;
|
||||
var len = contexts.length;
|
||||
var filledBufferContext;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var context = contexts[i];
|
||||
var buffer = context.buffer;
|
||||
buffer.push(value);
|
||||
if (buffer.length == this.maxBufferSize) {
|
||||
filledBufferContext = context;
|
||||
}
|
||||
}
|
||||
if (filledBufferContext) {
|
||||
this.onBufferFull(filledBufferContext);
|
||||
}
|
||||
};
|
||||
BufferTimeSubscriber.prototype._error = function (err) {
|
||||
this.contexts.length = 0;
|
||||
_super.prototype._error.call(this, err);
|
||||
};
|
||||
BufferTimeSubscriber.prototype._complete = function () {
|
||||
var _a = this, contexts = _a.contexts, destination = _a.destination;
|
||||
while (contexts.length > 0) {
|
||||
var context = contexts.shift();
|
||||
destination.next(context.buffer);
|
||||
}
|
||||
_super.prototype._complete.call(this);
|
||||
};
|
||||
/** @deprecated internal use only */ BufferTimeSubscriber.prototype._unsubscribe = function () {
|
||||
this.contexts = null;
|
||||
};
|
||||
BufferTimeSubscriber.prototype.onBufferFull = function (context) {
|
||||
this.closeContext(context);
|
||||
var closeAction = context.closeAction;
|
||||
closeAction.unsubscribe();
|
||||
this.remove(closeAction);
|
||||
if (!this.closed && this.timespanOnly) {
|
||||
context = this.openContext();
|
||||
var bufferTimeSpan = this.bufferTimeSpan;
|
||||
var timeSpanOnlyState = { subscriber: this, context: context, bufferTimeSpan: bufferTimeSpan };
|
||||
this.add(context.closeAction = this.scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState));
|
||||
}
|
||||
};
|
||||
BufferTimeSubscriber.prototype.openContext = function () {
|
||||
var context = new Context();
|
||||
this.contexts.push(context);
|
||||
return context;
|
||||
};
|
||||
BufferTimeSubscriber.prototype.closeContext = function (context) {
|
||||
this.destination.next(context.buffer);
|
||||
var contexts = this.contexts;
|
||||
var spliceIndex = contexts ? contexts.indexOf(context) : -1;
|
||||
if (spliceIndex >= 0) {
|
||||
contexts.splice(contexts.indexOf(context), 1);
|
||||
}
|
||||
};
|
||||
return BufferTimeSubscriber;
|
||||
}(Subscriber_1.Subscriber));
|
||||
function dispatchBufferTimeSpanOnly(state) {
|
||||
var subscriber = state.subscriber;
|
||||
var prevContext = state.context;
|
||||
if (prevContext) {
|
||||
subscriber.closeContext(prevContext);
|
||||
}
|
||||
if (!subscriber.closed) {
|
||||
state.context = subscriber.openContext();
|
||||
state.context.closeAction = this.schedule(state, state.bufferTimeSpan);
|
||||
}
|
||||
}
|
||||
function dispatchBufferCreation(state) {
|
||||
var bufferCreationInterval = state.bufferCreationInterval, bufferTimeSpan = state.bufferTimeSpan, subscriber = state.subscriber, scheduler = state.scheduler;
|
||||
var context = subscriber.openContext();
|
||||
var action = this;
|
||||
if (!subscriber.closed) {
|
||||
subscriber.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, { subscriber: subscriber, context: context }));
|
||||
action.schedule(state, bufferCreationInterval);
|
||||
}
|
||||
}
|
||||
function dispatchBufferClose(arg) {
|
||||
var subscriber = arg.subscriber, context = arg.context;
|
||||
subscriber.closeContext(context);
|
||||
}
|
||||
//# sourceMappingURL=bufferTime.js.map
|
1
node_modules/rxjs/operators/bufferTime.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/bufferTime.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
41
node_modules/rxjs/operators/bufferToggle.d.ts
generated
vendored
Normal file
41
node_modules/rxjs/operators/bufferToggle.d.ts
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
import { SubscribableOrPromise } from '../Observable';
|
||||
import { OperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* Buffers the source Observable values starting from an emission from
|
||||
* `openings` and ending when the output of `closingSelector` emits.
|
||||
*
|
||||
* <span class="informal">Collects values from the past as an array. Starts
|
||||
* collecting only when `opening` emits, and calls the `closingSelector`
|
||||
* function to get an Observable that tells when to close the buffer.</span>
|
||||
*
|
||||
* <img src="./img/bufferToggle.png" width="100%">
|
||||
*
|
||||
* Buffers values from the source by opening the buffer via signals from an
|
||||
* Observable provided to `openings`, and closing and sending the buffers when
|
||||
* a Subscribable or Promise returned by the `closingSelector` function emits.
|
||||
*
|
||||
* @example <caption>Every other second, emit the click events from the next 500ms</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var openings = Rx.Observable.interval(1000);
|
||||
* var buffered = clicks.bufferToggle(openings, i =>
|
||||
* i % 2 ? Rx.Observable.interval(500) : Rx.Observable.empty()
|
||||
* );
|
||||
* buffered.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link buffer}
|
||||
* @see {@link bufferCount}
|
||||
* @see {@link bufferTime}
|
||||
* @see {@link bufferWhen}
|
||||
* @see {@link windowToggle}
|
||||
*
|
||||
* @param {SubscribableOrPromise<O>} openings A Subscribable or Promise of notifications to start new
|
||||
* buffers.
|
||||
* @param {function(value: O): SubscribableOrPromise} closingSelector A function that takes
|
||||
* the value emitted by the `openings` observable and returns a Subscribable or Promise,
|
||||
* which, when it emits, signals that the associated buffer should be emitted
|
||||
* and cleared.
|
||||
* @return {Observable<T[]>} An observable of arrays of buffered values.
|
||||
* @method bufferToggle
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function bufferToggle<T, O>(openings: SubscribableOrPromise<O>, closingSelector: (value: O) => SubscribableOrPromise<any>): OperatorFunction<T, T[]>;
|
154
node_modules/rxjs/operators/bufferToggle.js
generated
vendored
Normal file
154
node_modules/rxjs/operators/bufferToggle.js
generated
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Subscription_1 = require('../Subscription');
|
||||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||||
/**
|
||||
* Buffers the source Observable values starting from an emission from
|
||||
* `openings` and ending when the output of `closingSelector` emits.
|
||||
*
|
||||
* <span class="informal">Collects values from the past as an array. Starts
|
||||
* collecting only when `opening` emits, and calls the `closingSelector`
|
||||
* function to get an Observable that tells when to close the buffer.</span>
|
||||
*
|
||||
* <img src="./img/bufferToggle.png" width="100%">
|
||||
*
|
||||
* Buffers values from the source by opening the buffer via signals from an
|
||||
* Observable provided to `openings`, and closing and sending the buffers when
|
||||
* a Subscribable or Promise returned by the `closingSelector` function emits.
|
||||
*
|
||||
* @example <caption>Every other second, emit the click events from the next 500ms</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var openings = Rx.Observable.interval(1000);
|
||||
* var buffered = clicks.bufferToggle(openings, i =>
|
||||
* i % 2 ? Rx.Observable.interval(500) : Rx.Observable.empty()
|
||||
* );
|
||||
* buffered.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link buffer}
|
||||
* @see {@link bufferCount}
|
||||
* @see {@link bufferTime}
|
||||
* @see {@link bufferWhen}
|
||||
* @see {@link windowToggle}
|
||||
*
|
||||
* @param {SubscribableOrPromise<O>} openings A Subscribable or Promise of notifications to start new
|
||||
* buffers.
|
||||
* @param {function(value: O): SubscribableOrPromise} closingSelector A function that takes
|
||||
* the value emitted by the `openings` observable and returns a Subscribable or Promise,
|
||||
* which, when it emits, signals that the associated buffer should be emitted
|
||||
* and cleared.
|
||||
* @return {Observable<T[]>} An observable of arrays of buffered values.
|
||||
* @method bufferToggle
|
||||
* @owner Observable
|
||||
*/
|
||||
function bufferToggle(openings, closingSelector) {
|
||||
return function bufferToggleOperatorFunction(source) {
|
||||
return source.lift(new BufferToggleOperator(openings, closingSelector));
|
||||
};
|
||||
}
|
||||
exports.bufferToggle = bufferToggle;
|
||||
var BufferToggleOperator = (function () {
|
||||
function BufferToggleOperator(openings, closingSelector) {
|
||||
this.openings = openings;
|
||||
this.closingSelector = closingSelector;
|
||||
}
|
||||
BufferToggleOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new BufferToggleSubscriber(subscriber, this.openings, this.closingSelector));
|
||||
};
|
||||
return BufferToggleOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var BufferToggleSubscriber = (function (_super) {
|
||||
__extends(BufferToggleSubscriber, _super);
|
||||
function BufferToggleSubscriber(destination, openings, closingSelector) {
|
||||
_super.call(this, destination);
|
||||
this.openings = openings;
|
||||
this.closingSelector = closingSelector;
|
||||
this.contexts = [];
|
||||
this.add(subscribeToResult_1.subscribeToResult(this, openings));
|
||||
}
|
||||
BufferToggleSubscriber.prototype._next = function (value) {
|
||||
var contexts = this.contexts;
|
||||
var len = contexts.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
contexts[i].buffer.push(value);
|
||||
}
|
||||
};
|
||||
BufferToggleSubscriber.prototype._error = function (err) {
|
||||
var contexts = this.contexts;
|
||||
while (contexts.length > 0) {
|
||||
var context = contexts.shift();
|
||||
context.subscription.unsubscribe();
|
||||
context.buffer = null;
|
||||
context.subscription = null;
|
||||
}
|
||||
this.contexts = null;
|
||||
_super.prototype._error.call(this, err);
|
||||
};
|
||||
BufferToggleSubscriber.prototype._complete = function () {
|
||||
var contexts = this.contexts;
|
||||
while (contexts.length > 0) {
|
||||
var context = contexts.shift();
|
||||
this.destination.next(context.buffer);
|
||||
context.subscription.unsubscribe();
|
||||
context.buffer = null;
|
||||
context.subscription = null;
|
||||
}
|
||||
this.contexts = null;
|
||||
_super.prototype._complete.call(this);
|
||||
};
|
||||
BufferToggleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
|
||||
outerValue ? this.closeBuffer(outerValue) : this.openBuffer(innerValue);
|
||||
};
|
||||
BufferToggleSubscriber.prototype.notifyComplete = function (innerSub) {
|
||||
this.closeBuffer(innerSub.context);
|
||||
};
|
||||
BufferToggleSubscriber.prototype.openBuffer = function (value) {
|
||||
try {
|
||||
var closingSelector = this.closingSelector;
|
||||
var closingNotifier = closingSelector.call(this, value);
|
||||
if (closingNotifier) {
|
||||
this.trySubscribe(closingNotifier);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
this._error(err);
|
||||
}
|
||||
};
|
||||
BufferToggleSubscriber.prototype.closeBuffer = function (context) {
|
||||
var contexts = this.contexts;
|
||||
if (contexts && context) {
|
||||
var buffer = context.buffer, subscription = context.subscription;
|
||||
this.destination.next(buffer);
|
||||
contexts.splice(contexts.indexOf(context), 1);
|
||||
this.remove(subscription);
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
};
|
||||
BufferToggleSubscriber.prototype.trySubscribe = function (closingNotifier) {
|
||||
var contexts = this.contexts;
|
||||
var buffer = [];
|
||||
var subscription = new Subscription_1.Subscription();
|
||||
var context = { buffer: buffer, subscription: subscription };
|
||||
contexts.push(context);
|
||||
var innerSubscription = subscribeToResult_1.subscribeToResult(this, closingNotifier, context);
|
||||
if (!innerSubscription || innerSubscription.closed) {
|
||||
this.closeBuffer(context);
|
||||
}
|
||||
else {
|
||||
innerSubscription.context = context;
|
||||
this.add(innerSubscription);
|
||||
subscription.add(innerSubscription);
|
||||
}
|
||||
};
|
||||
return BufferToggleSubscriber;
|
||||
}(OuterSubscriber_1.OuterSubscriber));
|
||||
//# sourceMappingURL=bufferToggle.js.map
|
1
node_modules/rxjs/operators/bufferToggle.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/bufferToggle.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
36
node_modules/rxjs/operators/bufferWhen.d.ts
generated
vendored
Normal file
36
node_modules/rxjs/operators/bufferWhen.d.ts
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { OperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* Buffers the source Observable values, using a factory function of closing
|
||||
* Observables to determine when to close, emit, and reset the buffer.
|
||||
*
|
||||
* <span class="informal">Collects values from the past as an array. When it
|
||||
* starts collecting values, it calls a function that returns an Observable that
|
||||
* tells when to close the buffer and restart collecting.</span>
|
||||
*
|
||||
* <img src="./img/bufferWhen.png" width="100%">
|
||||
*
|
||||
* Opens a buffer immediately, then closes the buffer when the observable
|
||||
* returned by calling `closingSelector` function emits a value. When it closes
|
||||
* the buffer, it immediately opens a new buffer and repeats the process.
|
||||
*
|
||||
* @example <caption>Emit an array of the last clicks every [1-5] random seconds</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var buffered = clicks.bufferWhen(() =>
|
||||
* Rx.Observable.interval(1000 + Math.random() * 4000)
|
||||
* );
|
||||
* buffered.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link buffer}
|
||||
* @see {@link bufferCount}
|
||||
* @see {@link bufferTime}
|
||||
* @see {@link bufferToggle}
|
||||
* @see {@link windowWhen}
|
||||
*
|
||||
* @param {function(): Observable} closingSelector A function that takes no
|
||||
* arguments and returns an Observable that signals buffer closure.
|
||||
* @return {Observable<T[]>} An observable of arrays of buffered values.
|
||||
* @method bufferWhen
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function bufferWhen<T>(closingSelector: () => Observable<any>): OperatorFunction<T, T[]>;
|
124
node_modules/rxjs/operators/bufferWhen.js
generated
vendored
Normal file
124
node_modules/rxjs/operators/bufferWhen.js
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Subscription_1 = require('../Subscription');
|
||||
var tryCatch_1 = require('../util/tryCatch');
|
||||
var errorObject_1 = require('../util/errorObject');
|
||||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||||
/**
|
||||
* Buffers the source Observable values, using a factory function of closing
|
||||
* Observables to determine when to close, emit, and reset the buffer.
|
||||
*
|
||||
* <span class="informal">Collects values from the past as an array. When it
|
||||
* starts collecting values, it calls a function that returns an Observable that
|
||||
* tells when to close the buffer and restart collecting.</span>
|
||||
*
|
||||
* <img src="./img/bufferWhen.png" width="100%">
|
||||
*
|
||||
* Opens a buffer immediately, then closes the buffer when the observable
|
||||
* returned by calling `closingSelector` function emits a value. When it closes
|
||||
* the buffer, it immediately opens a new buffer and repeats the process.
|
||||
*
|
||||
* @example <caption>Emit an array of the last clicks every [1-5] random seconds</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var buffered = clicks.bufferWhen(() =>
|
||||
* Rx.Observable.interval(1000 + Math.random() * 4000)
|
||||
* );
|
||||
* buffered.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link buffer}
|
||||
* @see {@link bufferCount}
|
||||
* @see {@link bufferTime}
|
||||
* @see {@link bufferToggle}
|
||||
* @see {@link windowWhen}
|
||||
*
|
||||
* @param {function(): Observable} closingSelector A function that takes no
|
||||
* arguments and returns an Observable that signals buffer closure.
|
||||
* @return {Observable<T[]>} An observable of arrays of buffered values.
|
||||
* @method bufferWhen
|
||||
* @owner Observable
|
||||
*/
|
||||
function bufferWhen(closingSelector) {
|
||||
return function (source) {
|
||||
return source.lift(new BufferWhenOperator(closingSelector));
|
||||
};
|
||||
}
|
||||
exports.bufferWhen = bufferWhen;
|
||||
var BufferWhenOperator = (function () {
|
||||
function BufferWhenOperator(closingSelector) {
|
||||
this.closingSelector = closingSelector;
|
||||
}
|
||||
BufferWhenOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new BufferWhenSubscriber(subscriber, this.closingSelector));
|
||||
};
|
||||
return BufferWhenOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var BufferWhenSubscriber = (function (_super) {
|
||||
__extends(BufferWhenSubscriber, _super);
|
||||
function BufferWhenSubscriber(destination, closingSelector) {
|
||||
_super.call(this, destination);
|
||||
this.closingSelector = closingSelector;
|
||||
this.subscribing = false;
|
||||
this.openBuffer();
|
||||
}
|
||||
BufferWhenSubscriber.prototype._next = function (value) {
|
||||
this.buffer.push(value);
|
||||
};
|
||||
BufferWhenSubscriber.prototype._complete = function () {
|
||||
var buffer = this.buffer;
|
||||
if (buffer) {
|
||||
this.destination.next(buffer);
|
||||
}
|
||||
_super.prototype._complete.call(this);
|
||||
};
|
||||
/** @deprecated internal use only */ BufferWhenSubscriber.prototype._unsubscribe = function () {
|
||||
this.buffer = null;
|
||||
this.subscribing = false;
|
||||
};
|
||||
BufferWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
|
||||
this.openBuffer();
|
||||
};
|
||||
BufferWhenSubscriber.prototype.notifyComplete = function () {
|
||||
if (this.subscribing) {
|
||||
this.complete();
|
||||
}
|
||||
else {
|
||||
this.openBuffer();
|
||||
}
|
||||
};
|
||||
BufferWhenSubscriber.prototype.openBuffer = function () {
|
||||
var closingSubscription = this.closingSubscription;
|
||||
if (closingSubscription) {
|
||||
this.remove(closingSubscription);
|
||||
closingSubscription.unsubscribe();
|
||||
}
|
||||
var buffer = this.buffer;
|
||||
if (this.buffer) {
|
||||
this.destination.next(buffer);
|
||||
}
|
||||
this.buffer = [];
|
||||
var closingNotifier = tryCatch_1.tryCatch(this.closingSelector)();
|
||||
if (closingNotifier === errorObject_1.errorObject) {
|
||||
this.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
else {
|
||||
closingSubscription = new Subscription_1.Subscription();
|
||||
this.closingSubscription = closingSubscription;
|
||||
this.add(closingSubscription);
|
||||
this.subscribing = true;
|
||||
closingSubscription.add(subscribeToResult_1.subscribeToResult(this, closingNotifier));
|
||||
this.subscribing = false;
|
||||
}
|
||||
};
|
||||
return BufferWhenSubscriber;
|
||||
}(OuterSubscriber_1.OuterSubscriber));
|
||||
//# sourceMappingURL=bufferWhen.js.map
|
1
node_modules/rxjs/operators/bufferWhen.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/bufferWhen.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
60
node_modules/rxjs/operators/catchError.d.ts
generated
vendored
Normal file
60
node_modules/rxjs/operators/catchError.d.ts
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
import { Observable, ObservableInput } from '../Observable';
|
||||
import { OperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* Catches errors on the observable to be handled by returning a new observable or throwing an error.
|
||||
*
|
||||
* <img src="./img/catch.png" width="100%">
|
||||
*
|
||||
* @example <caption>Continues with a different Observable when there's an error</caption>
|
||||
*
|
||||
* Observable.of(1, 2, 3, 4, 5)
|
||||
* .map(n => {
|
||||
* if (n == 4) {
|
||||
* throw 'four!';
|
||||
* }
|
||||
* return n;
|
||||
* })
|
||||
* .catch(err => Observable.of('I', 'II', 'III', 'IV', 'V'))
|
||||
* .subscribe(x => console.log(x));
|
||||
* // 1, 2, 3, I, II, III, IV, V
|
||||
*
|
||||
* @example <caption>Retries the caught source Observable again in case of error, similar to retry() operator</caption>
|
||||
*
|
||||
* Observable.of(1, 2, 3, 4, 5)
|
||||
* .map(n => {
|
||||
* if (n === 4) {
|
||||
* throw 'four!';
|
||||
* }
|
||||
* return n;
|
||||
* })
|
||||
* .catch((err, caught) => caught)
|
||||
* .take(30)
|
||||
* .subscribe(x => console.log(x));
|
||||
* // 1, 2, 3, 1, 2, 3, ...
|
||||
*
|
||||
* @example <caption>Throws a new error when the source Observable throws an error</caption>
|
||||
*
|
||||
* Observable.of(1, 2, 3, 4, 5)
|
||||
* .map(n => {
|
||||
* if (n == 4) {
|
||||
* throw 'four!';
|
||||
* }
|
||||
* return n;
|
||||
* })
|
||||
* .catch(err => {
|
||||
* throw 'error in source. Details: ' + err;
|
||||
* })
|
||||
* .subscribe(
|
||||
* x => console.log(x),
|
||||
* err => console.log(err)
|
||||
* );
|
||||
* // 1, 2, 3, error in source. Details: four!
|
||||
*
|
||||
* @param {function} selector a function that takes as arguments `err`, which is the error, and `caught`, which
|
||||
* is the source observable, in case you'd like to "retry" that observable by returning it again. Whatever observable
|
||||
* is returned by the `selector` will be used to continue the observable chain.
|
||||
* @return {Observable} An observable that originates from either the source or the observable returned by the
|
||||
* catch `selector` function.
|
||||
* @name catchError
|
||||
*/
|
||||
export declare function catchError<T, R>(selector: (err: any, caught: Observable<T>) => ObservableInput<R>): OperatorFunction<T, T | R>;
|
116
node_modules/rxjs/operators/catchError.js
generated
vendored
Normal file
116
node_modules/rxjs/operators/catchError.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||||
/**
|
||||
* Catches errors on the observable to be handled by returning a new observable or throwing an error.
|
||||
*
|
||||
* <img src="./img/catch.png" width="100%">
|
||||
*
|
||||
* @example <caption>Continues with a different Observable when there's an error</caption>
|
||||
*
|
||||
* Observable.of(1, 2, 3, 4, 5)
|
||||
* .map(n => {
|
||||
* if (n == 4) {
|
||||
* throw 'four!';
|
||||
* }
|
||||
* return n;
|
||||
* })
|
||||
* .catch(err => Observable.of('I', 'II', 'III', 'IV', 'V'))
|
||||
* .subscribe(x => console.log(x));
|
||||
* // 1, 2, 3, I, II, III, IV, V
|
||||
*
|
||||
* @example <caption>Retries the caught source Observable again in case of error, similar to retry() operator</caption>
|
||||
*
|
||||
* Observable.of(1, 2, 3, 4, 5)
|
||||
* .map(n => {
|
||||
* if (n === 4) {
|
||||
* throw 'four!';
|
||||
* }
|
||||
* return n;
|
||||
* })
|
||||
* .catch((err, caught) => caught)
|
||||
* .take(30)
|
||||
* .subscribe(x => console.log(x));
|
||||
* // 1, 2, 3, 1, 2, 3, ...
|
||||
*
|
||||
* @example <caption>Throws a new error when the source Observable throws an error</caption>
|
||||
*
|
||||
* Observable.of(1, 2, 3, 4, 5)
|
||||
* .map(n => {
|
||||
* if (n == 4) {
|
||||
* throw 'four!';
|
||||
* }
|
||||
* return n;
|
||||
* })
|
||||
* .catch(err => {
|
||||
* throw 'error in source. Details: ' + err;
|
||||
* })
|
||||
* .subscribe(
|
||||
* x => console.log(x),
|
||||
* err => console.log(err)
|
||||
* );
|
||||
* // 1, 2, 3, error in source. Details: four!
|
||||
*
|
||||
* @param {function} selector a function that takes as arguments `err`, which is the error, and `caught`, which
|
||||
* is the source observable, in case you'd like to "retry" that observable by returning it again. Whatever observable
|
||||
* is returned by the `selector` will be used to continue the observable chain.
|
||||
* @return {Observable} An observable that originates from either the source or the observable returned by the
|
||||
* catch `selector` function.
|
||||
* @name catchError
|
||||
*/
|
||||
function catchError(selector) {
|
||||
return function catchErrorOperatorFunction(source) {
|
||||
var operator = new CatchOperator(selector);
|
||||
var caught = source.lift(operator);
|
||||
return (operator.caught = caught);
|
||||
};
|
||||
}
|
||||
exports.catchError = catchError;
|
||||
var CatchOperator = (function () {
|
||||
function CatchOperator(selector) {
|
||||
this.selector = selector;
|
||||
}
|
||||
CatchOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new CatchSubscriber(subscriber, this.selector, this.caught));
|
||||
};
|
||||
return CatchOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var CatchSubscriber = (function (_super) {
|
||||
__extends(CatchSubscriber, _super);
|
||||
function CatchSubscriber(destination, selector, caught) {
|
||||
_super.call(this, destination);
|
||||
this.selector = selector;
|
||||
this.caught = caught;
|
||||
}
|
||||
// NOTE: overriding `error` instead of `_error` because we don't want
|
||||
// to have this flag this subscriber as `isStopped`. We can mimic the
|
||||
// behavior of the RetrySubscriber (from the `retry` operator), where
|
||||
// we unsubscribe from our source chain, reset our Subscriber flags,
|
||||
// then subscribe to the selector result.
|
||||
CatchSubscriber.prototype.error = function (err) {
|
||||
if (!this.isStopped) {
|
||||
var result = void 0;
|
||||
try {
|
||||
result = this.selector(err, this.caught);
|
||||
}
|
||||
catch (err2) {
|
||||
_super.prototype.error.call(this, err2);
|
||||
return;
|
||||
}
|
||||
this._unsubscribeAndRecycle();
|
||||
this.add(subscribeToResult_1.subscribeToResult(this, result));
|
||||
}
|
||||
};
|
||||
return CatchSubscriber;
|
||||
}(OuterSubscriber_1.OuterSubscriber));
|
||||
//# sourceMappingURL=catchError.js.map
|
1
node_modules/rxjs/operators/catchError.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/catchError.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
node_modules/rxjs/operators/combineAll.d.ts
generated
vendored
Normal file
2
node_modules/rxjs/operators/combineAll.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { OperatorFunction } from '../interfaces';
|
||||
export declare function combineAll<T, R>(project?: (...values: Array<any>) => R): OperatorFunction<T, R>;
|
7
node_modules/rxjs/operators/combineAll.js
generated
vendored
Normal file
7
node_modules/rxjs/operators/combineAll.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
var combineLatest_1 = require('../operators/combineLatest');
|
||||
function combineAll(project) {
|
||||
return function (source) { return source.lift(new combineLatest_1.CombineLatestOperator(project)); };
|
||||
}
|
||||
exports.combineAll = combineAll;
|
||||
//# sourceMappingURL=combineAll.js.map
|
1
node_modules/rxjs/operators/combineAll.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/combineAll.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"combineAll.js","sourceRoot":"","sources":["../../src/operators/combineAll.ts"],"names":[],"mappings":";AAAA,8BAAsC,4BAA4B,CAAC,CAAA;AAInE,oBAAiC,OAAsC;IACrE,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,qCAAqB,CAAC,OAAO,CAAC,CAAC,EAA/C,CAA+C,CAAC;AACpF,CAAC;AAFe,kBAAU,aAEzB,CAAA","sourcesContent":["import { CombineLatestOperator } from '../operators/combineLatest';\nimport { Observable } from '../Observable';\nimport { OperatorFunction } from '../interfaces';\n\nexport function combineAll<T, R>(project?: (...values: Array<any>) => R): OperatorFunction<T, R> {\n return (source: Observable<T>) => source.lift(new CombineLatestOperator(project));\n}\n"]}
|
43
node_modules/rxjs/operators/combineLatest.d.ts
generated
vendored
Normal file
43
node_modules/rxjs/operators/combineLatest.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import { ObservableInput } from '../Observable';
|
||||
import { Operator } from '../Operator';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { OuterSubscriber } from '../OuterSubscriber';
|
||||
import { InnerSubscriber } from '../InnerSubscriber';
|
||||
import { OperatorFunction } from '../interfaces';
|
||||
export declare function combineLatest<T, R>(project: (v1: T) => R): OperatorFunction<T, R>;
|
||||
export declare function combineLatest<T, T2, R>(v2: ObservableInput<T2>, project: (v1: T, v2: T2) => R): OperatorFunction<T, R>;
|
||||
export declare function combineLatest<T, T2, T3, R>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, project: (v1: T, v2: T2, v3: T3) => R): OperatorFunction<T, R>;
|
||||
export declare function combineLatest<T, T2, T3, T4, R>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, project: (v1: T, v2: T2, v3: T3, v4: T4) => R): OperatorFunction<T, R>;
|
||||
export declare function combineLatest<T, T2, T3, T4, T5, R>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, project: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => R): OperatorFunction<T, R>;
|
||||
export declare function combineLatest<T, T2, T3, T4, T5, T6, R>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, v6: ObservableInput<T6>, project: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) => R): OperatorFunction<T, R>;
|
||||
export declare function combineLatest<T, T2>(v2: ObservableInput<T2>): OperatorFunction<T, [T, T2]>;
|
||||
export declare function combineLatest<T, T2, T3>(v2: ObservableInput<T2>, v3: ObservableInput<T3>): OperatorFunction<T, [T, T2, T3]>;
|
||||
export declare function combineLatest<T, T2, T3, T4>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>): OperatorFunction<T, [T, T2, T3, T4]>;
|
||||
export declare function combineLatest<T, T2, T3, T4, T5>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>): OperatorFunction<T, [T, T2, T3, T4, T5]>;
|
||||
export declare function combineLatest<T, T2, T3, T4, T5, T6>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, v6: ObservableInput<T6>): OperatorFunction<T, [T, T2, T3, T4, T5, T6]>;
|
||||
export declare function combineLatest<T, R>(...observables: Array<ObservableInput<T> | ((...values: Array<T>) => R)>): OperatorFunction<T, R>;
|
||||
export declare function combineLatest<T, R>(array: ObservableInput<T>[]): OperatorFunction<T, Array<T>>;
|
||||
export declare function combineLatest<T, TOther, R>(array: ObservableInput<TOther>[], project: (v1: T, ...values: Array<TOther>) => R): OperatorFunction<T, R>;
|
||||
export declare class CombineLatestOperator<T, R> implements Operator<T, R> {
|
||||
private project;
|
||||
constructor(project?: (...values: Array<any>) => R);
|
||||
call(subscriber: Subscriber<R>, source: any): any;
|
||||
}
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
export declare class CombineLatestSubscriber<T, R> extends OuterSubscriber<T, R> {
|
||||
private project;
|
||||
private active;
|
||||
private values;
|
||||
private observables;
|
||||
private toRespond;
|
||||
constructor(destination: Subscriber<R>, project?: (...values: Array<any>) => R);
|
||||
protected _next(observable: any): void;
|
||||
protected _complete(): void;
|
||||
notifyComplete(unused: Subscriber<R>): void;
|
||||
notifyNext(outerValue: T, innerValue: R, outerIndex: number, innerIndex: number, innerSub: InnerSubscriber<T, R>): void;
|
||||
private _tryProject(values);
|
||||
}
|
151
node_modules/rxjs/operators/combineLatest.js
generated
vendored
Normal file
151
node_modules/rxjs/operators/combineLatest.js
generated
vendored
Normal file
@@ -0,0 +1,151 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var ArrayObservable_1 = require('../observable/ArrayObservable');
|
||||
var isArray_1 = require('../util/isArray');
|
||||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||||
var none = {};
|
||||
/* tslint:enable:max-line-length */
|
||||
/**
|
||||
* Combines multiple Observables to create an Observable whose values are
|
||||
* calculated from the latest values of each of its input Observables.
|
||||
*
|
||||
* <span class="informal">Whenever any input Observable emits a value, it
|
||||
* computes a formula using the latest values from all the inputs, then emits
|
||||
* the output of that formula.</span>
|
||||
*
|
||||
* <img src="./img/combineLatest.png" width="100%">
|
||||
*
|
||||
* `combineLatest` combines the values from this Observable with values from
|
||||
* Observables passed as arguments. This is done by subscribing to each
|
||||
* Observable, in order, and collecting an array of each of the most recent
|
||||
* values any time any of the input Observables emits, then either taking that
|
||||
* array and passing it as arguments to an optional `project` function and
|
||||
* emitting the return value of that, or just emitting the array of recent
|
||||
* values directly if there is no `project` function.
|
||||
*
|
||||
* @example <caption>Dynamically calculate the Body-Mass Index from an Observable of weight and one for height</caption>
|
||||
* var weight = Rx.Observable.of(70, 72, 76, 79, 75);
|
||||
* var height = Rx.Observable.of(1.76, 1.77, 1.78);
|
||||
* var bmi = weight.combineLatest(height, (w, h) => w / (h * h));
|
||||
* bmi.subscribe(x => console.log('BMI is ' + x));
|
||||
*
|
||||
* // With output to console:
|
||||
* // BMI is 24.212293388429753
|
||||
* // BMI is 23.93948099205209
|
||||
* // BMI is 23.671253629592222
|
||||
*
|
||||
* @see {@link combineAll}
|
||||
* @see {@link merge}
|
||||
* @see {@link withLatestFrom}
|
||||
*
|
||||
* @param {ObservableInput} other An input Observable to combine with the source
|
||||
* Observable. More than one input Observables may be given as argument.
|
||||
* @param {function} [project] An optional function to project the values from
|
||||
* the combined latest values into a new value on the output Observable.
|
||||
* @return {Observable} An Observable of projected values from the most recent
|
||||
* values from each input Observable, or an array of the most recent values from
|
||||
* each input Observable.
|
||||
* @method combineLatest
|
||||
* @owner Observable
|
||||
*/
|
||||
function combineLatest() {
|
||||
var observables = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
observables[_i - 0] = arguments[_i];
|
||||
}
|
||||
var project = null;
|
||||
if (typeof observables[observables.length - 1] === 'function') {
|
||||
project = observables.pop();
|
||||
}
|
||||
// if the first and only other argument besides the resultSelector is an array
|
||||
// assume it's been called with `combineLatest([obs1, obs2, obs3], project)`
|
||||
if (observables.length === 1 && isArray_1.isArray(observables[0])) {
|
||||
observables = observables[0].slice();
|
||||
}
|
||||
return function (source) { return source.lift.call(new ArrayObservable_1.ArrayObservable([source].concat(observables)), new CombineLatestOperator(project)); };
|
||||
}
|
||||
exports.combineLatest = combineLatest;
|
||||
var CombineLatestOperator = (function () {
|
||||
function CombineLatestOperator(project) {
|
||||
this.project = project;
|
||||
}
|
||||
CombineLatestOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new CombineLatestSubscriber(subscriber, this.project));
|
||||
};
|
||||
return CombineLatestOperator;
|
||||
}());
|
||||
exports.CombineLatestOperator = CombineLatestOperator;
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var CombineLatestSubscriber = (function (_super) {
|
||||
__extends(CombineLatestSubscriber, _super);
|
||||
function CombineLatestSubscriber(destination, project) {
|
||||
_super.call(this, destination);
|
||||
this.project = project;
|
||||
this.active = 0;
|
||||
this.values = [];
|
||||
this.observables = [];
|
||||
}
|
||||
CombineLatestSubscriber.prototype._next = function (observable) {
|
||||
this.values.push(none);
|
||||
this.observables.push(observable);
|
||||
};
|
||||
CombineLatestSubscriber.prototype._complete = function () {
|
||||
var observables = this.observables;
|
||||
var len = observables.length;
|
||||
if (len === 0) {
|
||||
this.destination.complete();
|
||||
}
|
||||
else {
|
||||
this.active = len;
|
||||
this.toRespond = len;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var observable = observables[i];
|
||||
this.add(subscribeToResult_1.subscribeToResult(this, observable, observable, i));
|
||||
}
|
||||
}
|
||||
};
|
||||
CombineLatestSubscriber.prototype.notifyComplete = function (unused) {
|
||||
if ((this.active -= 1) === 0) {
|
||||
this.destination.complete();
|
||||
}
|
||||
};
|
||||
CombineLatestSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
|
||||
var values = this.values;
|
||||
var oldVal = values[outerIndex];
|
||||
var toRespond = !this.toRespond
|
||||
? 0
|
||||
: oldVal === none ? --this.toRespond : this.toRespond;
|
||||
values[outerIndex] = innerValue;
|
||||
if (toRespond === 0) {
|
||||
if (this.project) {
|
||||
this._tryProject(values);
|
||||
}
|
||||
else {
|
||||
this.destination.next(values.slice());
|
||||
}
|
||||
}
|
||||
};
|
||||
CombineLatestSubscriber.prototype._tryProject = function (values) {
|
||||
var result;
|
||||
try {
|
||||
result = this.project.apply(this, values);
|
||||
}
|
||||
catch (err) {
|
||||
this.destination.error(err);
|
||||
return;
|
||||
}
|
||||
this.destination.next(result);
|
||||
};
|
||||
return CombineLatestSubscriber;
|
||||
}(OuterSubscriber_1.OuterSubscriber));
|
||||
exports.CombineLatestSubscriber = CombineLatestSubscriber;
|
||||
//# sourceMappingURL=combineLatest.js.map
|
1
node_modules/rxjs/operators/combineLatest.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/combineLatest.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
12
node_modules/rxjs/operators/concat.d.ts
generated
vendored
Normal file
12
node_modules/rxjs/operators/concat.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ObservableInput } from '../Observable';
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { OperatorFunction, MonoTypeOperatorFunction } from '../interfaces';
|
||||
export { concat as concatStatic } from '../observable/concat';
|
||||
export declare function concat<T>(scheduler?: IScheduler): MonoTypeOperatorFunction<T>;
|
||||
export declare function concat<T, T2>(v2: ObservableInput<T2>, scheduler?: IScheduler): OperatorFunction<T, T | T2>;
|
||||
export declare function concat<T, T2, T3>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, scheduler?: IScheduler): OperatorFunction<T, T | T2 | T3>;
|
||||
export declare function concat<T, T2, T3, T4>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, scheduler?: IScheduler): OperatorFunction<T, T | T2 | T3 | T4>;
|
||||
export declare function concat<T, T2, T3, T4, T5>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, scheduler?: IScheduler): OperatorFunction<T, T | T2 | T3 | T4 | T5>;
|
||||
export declare function concat<T, T2, T3, T4, T5, T6>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, v6: ObservableInput<T6>, scheduler?: IScheduler): OperatorFunction<T, T | T2 | T3 | T4 | T5 | T6>;
|
||||
export declare function concat<T>(...observables: Array<ObservableInput<T> | IScheduler>): MonoTypeOperatorFunction<T>;
|
||||
export declare function concat<T, R>(...observables: Array<ObservableInput<any> | IScheduler>): OperatorFunction<T, R>;
|
63
node_modules/rxjs/operators/concat.js
generated
vendored
Normal file
63
node_modules/rxjs/operators/concat.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
"use strict";
|
||||
var concat_1 = require('../observable/concat');
|
||||
var concat_2 = require('../observable/concat');
|
||||
exports.concatStatic = concat_2.concat;
|
||||
/* tslint:enable:max-line-length */
|
||||
/**
|
||||
* Creates an output Observable which sequentially emits all values from every
|
||||
* given input Observable after the current Observable.
|
||||
*
|
||||
* <span class="informal">Concatenates multiple Observables together by
|
||||
* sequentially emitting their values, one Observable after the other.</span>
|
||||
*
|
||||
* <img src="./img/concat.png" width="100%">
|
||||
*
|
||||
* Joins this Observable with multiple other Observables by subscribing to them
|
||||
* one at a time, starting with the source, and merging their results into the
|
||||
* output Observable. Will wait for each Observable to complete before moving
|
||||
* on to the next.
|
||||
*
|
||||
* @example <caption>Concatenate a timer counting from 0 to 3 with a synchronous sequence from 1 to 10</caption>
|
||||
* var timer = Rx.Observable.interval(1000).take(4);
|
||||
* var sequence = Rx.Observable.range(1, 10);
|
||||
* var result = timer.concat(sequence);
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* // results in:
|
||||
* // 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 -immediate-> 1 ... 10
|
||||
*
|
||||
* @example <caption>Concatenate 3 Observables</caption>
|
||||
* var timer1 = Rx.Observable.interval(1000).take(10);
|
||||
* var timer2 = Rx.Observable.interval(2000).take(6);
|
||||
* var timer3 = Rx.Observable.interval(500).take(10);
|
||||
* var result = timer1.concat(timer2, timer3);
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* // results in the following:
|
||||
* // (Prints to console sequentially)
|
||||
* // -1000ms-> 0 -1000ms-> 1 -1000ms-> ... 9
|
||||
* // -2000ms-> 0 -2000ms-> 1 -2000ms-> ... 5
|
||||
* // -500ms-> 0 -500ms-> 1 -500ms-> ... 9
|
||||
*
|
||||
* @see {@link concatAll}
|
||||
* @see {@link concatMap}
|
||||
* @see {@link concatMapTo}
|
||||
*
|
||||
* @param {ObservableInput} other An input Observable to concatenate after the source
|
||||
* Observable. More than one input Observables may be given as argument.
|
||||
* @param {Scheduler} [scheduler=null] An optional IScheduler to schedule each
|
||||
* Observable subscription on.
|
||||
* @return {Observable} All values of each passed Observable merged into a
|
||||
* single Observable, in order, in serial fashion.
|
||||
* @method concat
|
||||
* @owner Observable
|
||||
*/
|
||||
function concat() {
|
||||
var observables = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
observables[_i - 0] = arguments[_i];
|
||||
}
|
||||
return function (source) { return source.lift.call(concat_1.concat.apply(void 0, [source].concat(observables))); };
|
||||
}
|
||||
exports.concat = concat;
|
||||
//# sourceMappingURL=concat.js.map
|
1
node_modules/rxjs/operators/concat.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/concat.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"concat.js","sourceRoot":"","sources":["../../src/operators/concat.ts"],"names":[],"mappings":";AAGA,uBAAuC,sBAAsB,CAAC,CAAA;AAE9D,uBAAuC,sBAAsB,CAAC;AAArD,uCAAqD;AAW9D,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH;IAA6B,qBAAwD;SAAxD,WAAwD,CAAxD,sBAAwD,CAAxD,IAAwD;QAAxD,oCAAwD;;IACnF,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,eAAY,gBAAO,MAAM,SAAK,WAAW,EAAC,CAAC,EAA5D,CAA4D,CAAC;AACjG,CAAC;AAFe,cAAM,SAErB,CAAA","sourcesContent":["import { Observable, ObservableInput } from '../Observable';\nimport { IScheduler } from '../Scheduler';\nimport { OperatorFunction, MonoTypeOperatorFunction } from '../interfaces';\nimport { concat as concatStatic } from '../observable/concat';\n\nexport { concat as concatStatic } from '../observable/concat';\n\n/* tslint:disable:max-line-length */\nexport function concat<T>(scheduler?: IScheduler): MonoTypeOperatorFunction<T>;\nexport function concat<T, T2>(v2: ObservableInput<T2>, scheduler?: IScheduler): OperatorFunction<T, T | T2>;\nexport function concat<T, T2, T3>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, scheduler?: IScheduler): OperatorFunction<T, T | T2 | T3>;\nexport function concat<T, T2, T3, T4>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, scheduler?: IScheduler): OperatorFunction<T, T | T2 | T3 | T4>;\nexport function concat<T, T2, T3, T4, T5>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, scheduler?: IScheduler): OperatorFunction<T, T | T2 | T3 | T4 | T5>;\nexport function concat<T, T2, T3, T4, T5, T6>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, v6: ObservableInput<T6>, scheduler?: IScheduler): OperatorFunction<T, T | T2 | T3 | T4 | T5 | T6>;\nexport function concat<T>(...observables: Array<ObservableInput<T> | IScheduler>): MonoTypeOperatorFunction<T>;\nexport function concat<T, R>(...observables: Array<ObservableInput<any> | IScheduler>): OperatorFunction<T, R>;\n/* tslint:enable:max-line-length */\n\n/**\n * Creates an output Observable which sequentially emits all values from every\n * given input Observable after the current Observable.\n *\n * <span class=\"informal\">Concatenates multiple Observables together by\n * sequentially emitting their values, one Observable after the other.</span>\n *\n * <img src=\"./img/concat.png\" width=\"100%\">\n *\n * Joins this Observable with multiple other Observables by subscribing to them\n * one at a time, starting with the source, and merging their results into the\n * output Observable. Will wait for each Observable to complete before moving\n * on to the next.\n *\n * @example <caption>Concatenate a timer counting from 0 to 3 with a synchronous sequence from 1 to 10</caption>\n * var timer = Rx.Observable.interval(1000).take(4);\n * var sequence = Rx.Observable.range(1, 10);\n * var result = timer.concat(sequence);\n * result.subscribe(x => console.log(x));\n *\n * // results in:\n * // 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 -immediate-> 1 ... 10\n *\n * @example <caption>Concatenate 3 Observables</caption>\n * var timer1 = Rx.Observable.interval(1000).take(10);\n * var timer2 = Rx.Observable.interval(2000).take(6);\n * var timer3 = Rx.Observable.interval(500).take(10);\n * var result = timer1.concat(timer2, timer3);\n * result.subscribe(x => console.log(x));\n *\n * // results in the following:\n * // (Prints to console sequentially)\n * // -1000ms-> 0 -1000ms-> 1 -1000ms-> ... 9\n * // -2000ms-> 0 -2000ms-> 1 -2000ms-> ... 5\n * // -500ms-> 0 -500ms-> 1 -500ms-> ... 9\n *\n * @see {@link concatAll}\n * @see {@link concatMap}\n * @see {@link concatMapTo}\n *\n * @param {ObservableInput} other An input Observable to concatenate after the source\n * Observable. More than one input Observables may be given as argument.\n * @param {Scheduler} [scheduler=null] An optional IScheduler to schedule each\n * Observable subscription on.\n * @return {Observable} All values of each passed Observable merged into a\n * single Observable, in order, in serial fashion.\n * @method concat\n * @owner Observable\n */\nexport function concat<T, R>(...observables: Array<ObservableInput<any> | IScheduler>): OperatorFunction<T, R> {\n return (source: Observable<T>) => source.lift.call(concatStatic<T, R>(source, ...observables));\n}\n"]}
|
50
node_modules/rxjs/operators/concatAll.d.ts
generated
vendored
Normal file
50
node_modules/rxjs/operators/concatAll.d.ts
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
import { MonoTypeOperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* Converts a higher-order Observable into a first-order Observable by
|
||||
* concatenating the inner Observables in order.
|
||||
*
|
||||
* <span class="informal">Flattens an Observable-of-Observables by putting one
|
||||
* inner Observable after the other.</span>
|
||||
*
|
||||
* <img src="./img/concatAll.png" width="100%">
|
||||
*
|
||||
* Joins every Observable emitted by the source (a higher-order Observable), in
|
||||
* a serial fashion. It subscribes to each inner Observable only after the
|
||||
* previous inner Observable has completed, and merges all of their values into
|
||||
* the returned observable.
|
||||
*
|
||||
* __Warning:__ If the source Observable emits Observables quickly and
|
||||
* endlessly, and the inner Observables it emits generally complete slower than
|
||||
* the source emits, you can run into memory issues as the incoming Observables
|
||||
* collect in an unbounded buffer.
|
||||
*
|
||||
* Note: `concatAll` is equivalent to `mergeAll` with concurrency parameter set
|
||||
* to `1`.
|
||||
*
|
||||
* @example <caption>For each click event, tick every second from 0 to 3, with no concurrency</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var higherOrder = clicks.map(ev => Rx.Observable.interval(1000).take(4));
|
||||
* var firstOrder = higherOrder.concatAll();
|
||||
* firstOrder.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Results in the following:
|
||||
* // (results are not concurrent)
|
||||
* // For every click on the "document" it will emit values 0 to 3 spaced
|
||||
* // on a 1000ms interval
|
||||
* // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3
|
||||
*
|
||||
* @see {@link combineAll}
|
||||
* @see {@link concat}
|
||||
* @see {@link concatMap}
|
||||
* @see {@link concatMapTo}
|
||||
* @see {@link exhaust}
|
||||
* @see {@link mergeAll}
|
||||
* @see {@link switch}
|
||||
* @see {@link zipAll}
|
||||
*
|
||||
* @return {Observable} An Observable emitting values from all the inner
|
||||
* Observables concatenated.
|
||||
* @method concatAll
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function concatAll<T>(): MonoTypeOperatorFunction<T>;
|
55
node_modules/rxjs/operators/concatAll.js
generated
vendored
Normal file
55
node_modules/rxjs/operators/concatAll.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
var mergeAll_1 = require('./mergeAll');
|
||||
/**
|
||||
* Converts a higher-order Observable into a first-order Observable by
|
||||
* concatenating the inner Observables in order.
|
||||
*
|
||||
* <span class="informal">Flattens an Observable-of-Observables by putting one
|
||||
* inner Observable after the other.</span>
|
||||
*
|
||||
* <img src="./img/concatAll.png" width="100%">
|
||||
*
|
||||
* Joins every Observable emitted by the source (a higher-order Observable), in
|
||||
* a serial fashion. It subscribes to each inner Observable only after the
|
||||
* previous inner Observable has completed, and merges all of their values into
|
||||
* the returned observable.
|
||||
*
|
||||
* __Warning:__ If the source Observable emits Observables quickly and
|
||||
* endlessly, and the inner Observables it emits generally complete slower than
|
||||
* the source emits, you can run into memory issues as the incoming Observables
|
||||
* collect in an unbounded buffer.
|
||||
*
|
||||
* Note: `concatAll` is equivalent to `mergeAll` with concurrency parameter set
|
||||
* to `1`.
|
||||
*
|
||||
* @example <caption>For each click event, tick every second from 0 to 3, with no concurrency</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var higherOrder = clicks.map(ev => Rx.Observable.interval(1000).take(4));
|
||||
* var firstOrder = higherOrder.concatAll();
|
||||
* firstOrder.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Results in the following:
|
||||
* // (results are not concurrent)
|
||||
* // For every click on the "document" it will emit values 0 to 3 spaced
|
||||
* // on a 1000ms interval
|
||||
* // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3
|
||||
*
|
||||
* @see {@link combineAll}
|
||||
* @see {@link concat}
|
||||
* @see {@link concatMap}
|
||||
* @see {@link concatMapTo}
|
||||
* @see {@link exhaust}
|
||||
* @see {@link mergeAll}
|
||||
* @see {@link switch}
|
||||
* @see {@link zipAll}
|
||||
*
|
||||
* @return {Observable} An Observable emitting values from all the inner
|
||||
* Observables concatenated.
|
||||
* @method concatAll
|
||||
* @owner Observable
|
||||
*/
|
||||
function concatAll() {
|
||||
return mergeAll_1.mergeAll(1);
|
||||
}
|
||||
exports.concatAll = concatAll;
|
||||
//# sourceMappingURL=concatAll.js.map
|
1
node_modules/rxjs/operators/concatAll.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/concatAll.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"concatAll.js","sourceRoot":"","sources":["../../src/operators/concatAll.ts"],"names":[],"mappings":";AACA,yBAAyB,YAAY,CAAC,CAAA;AAGtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH;IACE,MAAM,CAAC,mBAAQ,CAAC,CAAC,CAAC,CAAC;AACrB,CAAC;AAFe,iBAAS,YAExB,CAAA","sourcesContent":["\nimport { mergeAll } from './mergeAll';\nimport { MonoTypeOperatorFunction } from '../interfaces';\n\n/**\n * Converts a higher-order Observable into a first-order Observable by\n * concatenating the inner Observables in order.\n *\n * <span class=\"informal\">Flattens an Observable-of-Observables by putting one\n * inner Observable after the other.</span>\n *\n * <img src=\"./img/concatAll.png\" width=\"100%\">\n *\n * Joins every Observable emitted by the source (a higher-order Observable), in\n * a serial fashion. It subscribes to each inner Observable only after the\n * previous inner Observable has completed, and merges all of their values into\n * the returned observable.\n *\n * __Warning:__ If the source Observable emits Observables quickly and\n * endlessly, and the inner Observables it emits generally complete slower than\n * the source emits, you can run into memory issues as the incoming Observables\n * collect in an unbounded buffer.\n *\n * Note: `concatAll` is equivalent to `mergeAll` with concurrency parameter set\n * to `1`.\n *\n * @example <caption>For each click event, tick every second from 0 to 3, with no concurrency</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var higherOrder = clicks.map(ev => Rx.Observable.interval(1000).take(4));\n * var firstOrder = higherOrder.concatAll();\n * firstOrder.subscribe(x => console.log(x));\n *\n * // Results in the following:\n * // (results are not concurrent)\n * // For every click on the \"document\" it will emit values 0 to 3 spaced\n * // on a 1000ms interval\n * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3\n *\n * @see {@link combineAll}\n * @see {@link concat}\n * @see {@link concatMap}\n * @see {@link concatMapTo}\n * @see {@link exhaust}\n * @see {@link mergeAll}\n * @see {@link switch}\n * @see {@link zipAll}\n *\n * @return {Observable} An Observable emitting values from all the inner\n * Observables concatenated.\n * @method concatAll\n * @owner Observable\n */\nexport function concatAll<T>(): MonoTypeOperatorFunction<T> {\n return mergeAll(1);\n}\n"]}
|
4
node_modules/rxjs/operators/concatMap.d.ts
generated
vendored
Normal file
4
node_modules/rxjs/operators/concatMap.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import { ObservableInput } from '../Observable';
|
||||
import { OperatorFunction } from '../interfaces';
|
||||
export declare function concatMap<T, R>(project: (value: T, index: number) => ObservableInput<R>): OperatorFunction<T, R>;
|
||||
export declare function concatMap<T, I, R>(project: (value: T, index: number) => ObservableInput<I>, resultSelector: (outerValue: T, innerValue: I, outerIndex: number, innerIndex: number) => R): OperatorFunction<T, R>;
|
67
node_modules/rxjs/operators/concatMap.js
generated
vendored
Normal file
67
node_modules/rxjs/operators/concatMap.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
var mergeMap_1 = require('./mergeMap');
|
||||
/* tslint:enable:max-line-length */
|
||||
/**
|
||||
* Projects each source value to an Observable which is merged in the output
|
||||
* Observable, in a serialized fashion waiting for each one to complete before
|
||||
* merging the next.
|
||||
*
|
||||
* <span class="informal">Maps each value to an Observable, then flattens all of
|
||||
* these inner Observables using {@link concatAll}.</span>
|
||||
*
|
||||
* <img src="./img/concatMap.png" width="100%">
|
||||
*
|
||||
* Returns an Observable that emits items based on applying a function that you
|
||||
* supply to each item emitted by the source Observable, where that function
|
||||
* returns an (so-called "inner") Observable. Each new inner Observable is
|
||||
* concatenated with the previous inner Observable.
|
||||
*
|
||||
* __Warning:__ if source values arrive endlessly and faster than their
|
||||
* corresponding inner Observables can complete, it will result in memory issues
|
||||
* as inner Observables amass in an unbounded buffer waiting for their turn to
|
||||
* be subscribed to.
|
||||
*
|
||||
* Note: `concatMap` is equivalent to `mergeMap` with concurrency parameter set
|
||||
* to `1`.
|
||||
*
|
||||
* @example <caption>For each click event, tick every second from 0 to 3, with no concurrency</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var result = clicks.concatMap(ev => Rx.Observable.interval(1000).take(4));
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Results in the following:
|
||||
* // (results are not concurrent)
|
||||
* // For every click on the "document" it will emit values 0 to 3 spaced
|
||||
* // on a 1000ms interval
|
||||
* // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3
|
||||
*
|
||||
* @see {@link concat}
|
||||
* @see {@link concatAll}
|
||||
* @see {@link concatMapTo}
|
||||
* @see {@link exhaustMap}
|
||||
* @see {@link mergeMap}
|
||||
* @see {@link switchMap}
|
||||
*
|
||||
* @param {function(value: T, ?index: number): ObservableInput} project A function
|
||||
* that, when applied to an item emitted by the source Observable, returns an
|
||||
* Observable.
|
||||
* @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector]
|
||||
* A function to produce the value on the output Observable based on the values
|
||||
* and the indices of the source (outer) emission and the inner Observable
|
||||
* emission. The arguments passed to this function are:
|
||||
* - `outerValue`: the value that came from the source
|
||||
* - `innerValue`: the value that came from the projected Observable
|
||||
* - `outerIndex`: the "index" of the value that came from the source
|
||||
* - `innerIndex`: the "index" of the value from the projected Observable
|
||||
* @return {Observable} An Observable that emits the result of applying the
|
||||
* projection function (and the optional `resultSelector`) to each item emitted
|
||||
* by the source Observable and taking values from each projected inner
|
||||
* Observable sequentially.
|
||||
* @method concatMap
|
||||
* @owner Observable
|
||||
*/
|
||||
function concatMap(project, resultSelector) {
|
||||
return mergeMap_1.mergeMap(project, resultSelector, 1);
|
||||
}
|
||||
exports.concatMap = concatMap;
|
||||
//# sourceMappingURL=concatMap.js.map
|
1
node_modules/rxjs/operators/concatMap.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/concatMap.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"concatMap.js","sourceRoot":"","sources":["../../src/operators/concatMap.ts"],"names":[],"mappings":";AAAA,yBAAyB,YAAY,CAAC,CAAA;AAOtC,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,mBAAmC,OAAyD,EACzD,cAA4F;IAC7H,MAAM,CAAC,mBAAQ,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC;AAC9C,CAAC;AAHe,iBAAS,YAGxB,CAAA","sourcesContent":["import { mergeMap } from './mergeMap';\nimport { ObservableInput } from '../Observable';\nimport { OperatorFunction } from '../interfaces';\n\n/* tslint:disable:max-line-length */\nexport function concatMap<T, R>(project: (value: T, index: number) => ObservableInput<R>): OperatorFunction<T, R>;\nexport function concatMap<T, I, R>(project: (value: T, index: number) => ObservableInput<I>, resultSelector: (outerValue: T, innerValue: I, outerIndex: number, innerIndex: number) => R): OperatorFunction<T, R>;\n/* tslint:enable:max-line-length */\n\n/**\n * Projects each source value to an Observable which is merged in the output\n * Observable, in a serialized fashion waiting for each one to complete before\n * merging the next.\n *\n * <span class=\"informal\">Maps each value to an Observable, then flattens all of\n * these inner Observables using {@link concatAll}.</span>\n *\n * <img src=\"./img/concatMap.png\" width=\"100%\">\n *\n * Returns an Observable that emits items based on applying a function that you\n * supply to each item emitted by the source Observable, where that function\n * returns an (so-called \"inner\") Observable. Each new inner Observable is\n * concatenated with the previous inner Observable.\n *\n * __Warning:__ if source values arrive endlessly and faster than their\n * corresponding inner Observables can complete, it will result in memory issues\n * as inner Observables amass in an unbounded buffer waiting for their turn to\n * be subscribed to.\n *\n * Note: `concatMap` is equivalent to `mergeMap` with concurrency parameter set\n * to `1`.\n *\n * @example <caption>For each click event, tick every second from 0 to 3, with no concurrency</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.concatMap(ev => Rx.Observable.interval(1000).take(4));\n * result.subscribe(x => console.log(x));\n *\n * // Results in the following:\n * // (results are not concurrent)\n * // For every click on the \"document\" it will emit values 0 to 3 spaced\n * // on a 1000ms interval\n * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3\n *\n * @see {@link concat}\n * @see {@link concatAll}\n * @see {@link concatMapTo}\n * @see {@link exhaustMap}\n * @see {@link mergeMap}\n * @see {@link switchMap}\n *\n * @param {function(value: T, ?index: number): ObservableInput} project A function\n * that, when applied to an item emitted by the source Observable, returns an\n * Observable.\n * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector]\n * A function to produce the value on the output Observable based on the values\n * and the indices of the source (outer) emission and the inner Observable\n * emission. The arguments passed to this function are:\n * - `outerValue`: the value that came from the source\n * - `innerValue`: the value that came from the projected Observable\n * - `outerIndex`: the \"index\" of the value that came from the source\n * - `innerIndex`: the \"index\" of the value from the projected Observable\n * @return {Observable} An Observable that emits the result of applying the\n * projection function (and the optional `resultSelector`) to each item emitted\n * by the source Observable and taking values from each projected inner\n * Observable sequentially.\n * @method concatMap\n * @owner Observable\n */\nexport function concatMap<T, I, R>(project: (value: T, index: number) => ObservableInput<I>,\n resultSelector?: (outerValue: T, innerValue: I, outerIndex: number, innerIndex: number) => R) {\n return mergeMap(project, resultSelector, 1);\n}\n"]}
|
4
node_modules/rxjs/operators/concatMapTo.d.ts
generated
vendored
Normal file
4
node_modules/rxjs/operators/concatMapTo.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import { ObservableInput } from '../Observable';
|
||||
import { OperatorFunction } from '../interfaces';
|
||||
export declare function concatMapTo<T, R>(observable: ObservableInput<R>): OperatorFunction<T, R>;
|
||||
export declare function concatMapTo<T, I, R>(observable: ObservableInput<I>, resultSelector: (outerValue: T, innerValue: I, outerIndex: number, innerIndex: number) => R): OperatorFunction<T, R>;
|
64
node_modules/rxjs/operators/concatMapTo.js
generated
vendored
Normal file
64
node_modules/rxjs/operators/concatMapTo.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
"use strict";
|
||||
var concatMap_1 = require('./concatMap');
|
||||
/* tslint:enable:max-line-length */
|
||||
/**
|
||||
* Projects each source value to the same Observable which is merged multiple
|
||||
* times in a serialized fashion on the output Observable.
|
||||
*
|
||||
* <span class="informal">It's like {@link concatMap}, but maps each value
|
||||
* always to the same inner Observable.</span>
|
||||
*
|
||||
* <img src="./img/concatMapTo.png" width="100%">
|
||||
*
|
||||
* Maps each source value to the given Observable `innerObservable` regardless
|
||||
* of the source value, and then flattens those resulting Observables into one
|
||||
* single Observable, which is the output Observable. Each new `innerObservable`
|
||||
* instance emitted on the output Observable is concatenated with the previous
|
||||
* `innerObservable` instance.
|
||||
*
|
||||
* __Warning:__ if source values arrive endlessly and faster than their
|
||||
* corresponding inner Observables can complete, it will result in memory issues
|
||||
* as inner Observables amass in an unbounded buffer waiting for their turn to
|
||||
* be subscribed to.
|
||||
*
|
||||
* Note: `concatMapTo` is equivalent to `mergeMapTo` with concurrency parameter
|
||||
* set to `1`.
|
||||
*
|
||||
* @example <caption>For each click event, tick every second from 0 to 3, with no concurrency</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var result = clicks.concatMapTo(Rx.Observable.interval(1000).take(4));
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Results in the following:
|
||||
* // (results are not concurrent)
|
||||
* // For every click on the "document" it will emit values 0 to 3 spaced
|
||||
* // on a 1000ms interval
|
||||
* // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3
|
||||
*
|
||||
* @see {@link concat}
|
||||
* @see {@link concatAll}
|
||||
* @see {@link concatMap}
|
||||
* @see {@link mergeMapTo}
|
||||
* @see {@link switchMapTo}
|
||||
*
|
||||
* @param {ObservableInput} innerObservable An Observable to replace each value from
|
||||
* the source Observable.
|
||||
* @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector]
|
||||
* A function to produce the value on the output Observable based on the values
|
||||
* and the indices of the source (outer) emission and the inner Observable
|
||||
* emission. The arguments passed to this function are:
|
||||
* - `outerValue`: the value that came from the source
|
||||
* - `innerValue`: the value that came from the projected Observable
|
||||
* - `outerIndex`: the "index" of the value that came from the source
|
||||
* - `innerIndex`: the "index" of the value from the projected Observable
|
||||
* @return {Observable} An observable of values merged together by joining the
|
||||
* passed observable with itself, one after the other, for each value emitted
|
||||
* from the source.
|
||||
* @method concatMapTo
|
||||
* @owner Observable
|
||||
*/
|
||||
function concatMapTo(innerObservable, resultSelector) {
|
||||
return concatMap_1.concatMap(function () { return innerObservable; }, resultSelector);
|
||||
}
|
||||
exports.concatMapTo = concatMapTo;
|
||||
//# sourceMappingURL=concatMapTo.js.map
|
1
node_modules/rxjs/operators/concatMapTo.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/concatMapTo.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"concatMapTo.js","sourceRoot":"","sources":["../../src/operators/concatMapTo.ts"],"names":[],"mappings":";AACA,0BAA0B,aAAa,CAAC,CAAA;AAMxC,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,qBACE,eAA8B,EAC9B,cAA4F;IAE5F,MAAM,CAAC,qBAAS,CAAC,cAAM,OAAA,eAAe,EAAf,CAAe,EAAE,cAAc,CAAC,CAAC;AAC1D,CAAC;AALe,mBAAW,cAK1B,CAAA","sourcesContent":["import { Observable, ObservableInput } from '../Observable';\nimport { concatMap } from './concatMap';\nimport { OperatorFunction } from '../interfaces';\n\n/* tslint:disable:max-line-length */\nexport function concatMapTo<T, R>(observable: ObservableInput<R>): OperatorFunction<T, R>;\nexport function concatMapTo<T, I, R>(observable: ObservableInput<I>, resultSelector: (outerValue: T, innerValue: I, outerIndex: number, innerIndex: number) => R): OperatorFunction<T, R>;\n/* tslint:enable:max-line-length */\n\n/**\n * Projects each source value to the same Observable which is merged multiple\n * times in a serialized fashion on the output Observable.\n *\n * <span class=\"informal\">It's like {@link concatMap}, but maps each value\n * always to the same inner Observable.</span>\n *\n * <img src=\"./img/concatMapTo.png\" width=\"100%\">\n *\n * Maps each source value to the given Observable `innerObservable` regardless\n * of the source value, and then flattens those resulting Observables into one\n * single Observable, which is the output Observable. Each new `innerObservable`\n * instance emitted on the output Observable is concatenated with the previous\n * `innerObservable` instance.\n *\n * __Warning:__ if source values arrive endlessly and faster than their\n * corresponding inner Observables can complete, it will result in memory issues\n * as inner Observables amass in an unbounded buffer waiting for their turn to\n * be subscribed to.\n *\n * Note: `concatMapTo` is equivalent to `mergeMapTo` with concurrency parameter\n * set to `1`.\n *\n * @example <caption>For each click event, tick every second from 0 to 3, with no concurrency</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.concatMapTo(Rx.Observable.interval(1000).take(4));\n * result.subscribe(x => console.log(x));\n *\n * // Results in the following:\n * // (results are not concurrent)\n * // For every click on the \"document\" it will emit values 0 to 3 spaced\n * // on a 1000ms interval\n * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3\n *\n * @see {@link concat}\n * @see {@link concatAll}\n * @see {@link concatMap}\n * @see {@link mergeMapTo}\n * @see {@link switchMapTo}\n *\n * @param {ObservableInput} innerObservable An Observable to replace each value from\n * the source Observable.\n * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector]\n * A function to produce the value on the output Observable based on the values\n * and the indices of the source (outer) emission and the inner Observable\n * emission. The arguments passed to this function are:\n * - `outerValue`: the value that came from the source\n * - `innerValue`: the value that came from the projected Observable\n * - `outerIndex`: the \"index\" of the value that came from the source\n * - `innerIndex`: the \"index\" of the value from the projected Observable\n * @return {Observable} An observable of values merged together by joining the\n * passed observable with itself, one after the other, for each value emitted\n * from the source.\n * @method concatMapTo\n * @owner Observable\n */\nexport function concatMapTo<T, I, R>(\n innerObservable: Observable<I>,\n resultSelector?: (outerValue: T, innerValue: I, outerIndex: number, innerIndex: number) => R\n): OperatorFunction<T, R> {\n return concatMap(() => innerObservable, resultSelector);\n}\n"]}
|
51
node_modules/rxjs/operators/count.d.ts
generated
vendored
Normal file
51
node_modules/rxjs/operators/count.d.ts
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { OperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* Counts the number of emissions on the source and emits that number when the
|
||||
* source completes.
|
||||
*
|
||||
* <span class="informal">Tells how many values were emitted, when the source
|
||||
* completes.</span>
|
||||
*
|
||||
* <img src="./img/count.png" width="100%">
|
||||
*
|
||||
* `count` transforms an Observable that emits values into an Observable that
|
||||
* emits a single value that represents the number of values emitted by the
|
||||
* source Observable. If the source Observable terminates with an error, `count`
|
||||
* will pass this error notification along without emitting a value first. If
|
||||
* the source Observable does not terminate at all, `count` will neither emit
|
||||
* a value nor terminate. This operator takes an optional `predicate` function
|
||||
* as argument, in which case the output emission will represent the number of
|
||||
* source values that matched `true` with the `predicate`.
|
||||
*
|
||||
* @example <caption>Counts how many seconds have passed before the first click happened</caption>
|
||||
* var seconds = Rx.Observable.interval(1000);
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var secondsBeforeClick = seconds.takeUntil(clicks);
|
||||
* var result = secondsBeforeClick.count();
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @example <caption>Counts how many odd numbers are there between 1 and 7</caption>
|
||||
* var numbers = Rx.Observable.range(1, 7);
|
||||
* var result = numbers.count(i => i % 2 === 1);
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Results in:
|
||||
* // 4
|
||||
*
|
||||
* @see {@link max}
|
||||
* @see {@link min}
|
||||
* @see {@link reduce}
|
||||
*
|
||||
* @param {function(value: T, i: number, source: Observable<T>): boolean} [predicate] A
|
||||
* boolean function to select what values are to be counted. It is provided with
|
||||
* arguments of:
|
||||
* - `value`: the value from the source Observable.
|
||||
* - `index`: the (zero-based) "index" of the value from the source Observable.
|
||||
* - `source`: the source Observable instance itself.
|
||||
* @return {Observable} An Observable of one number that represents the count as
|
||||
* described above.
|
||||
* @method count
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function count<T>(predicate?: (value: T, index: number, source: Observable<T>) => boolean): OperatorFunction<T, number>;
|
111
node_modules/rxjs/operators/count.js
generated
vendored
Normal file
111
node_modules/rxjs/operators/count.js
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Subscriber_1 = require('../Subscriber');
|
||||
/**
|
||||
* Counts the number of emissions on the source and emits that number when the
|
||||
* source completes.
|
||||
*
|
||||
* <span class="informal">Tells how many values were emitted, when the source
|
||||
* completes.</span>
|
||||
*
|
||||
* <img src="./img/count.png" width="100%">
|
||||
*
|
||||
* `count` transforms an Observable that emits values into an Observable that
|
||||
* emits a single value that represents the number of values emitted by the
|
||||
* source Observable. If the source Observable terminates with an error, `count`
|
||||
* will pass this error notification along without emitting a value first. If
|
||||
* the source Observable does not terminate at all, `count` will neither emit
|
||||
* a value nor terminate. This operator takes an optional `predicate` function
|
||||
* as argument, in which case the output emission will represent the number of
|
||||
* source values that matched `true` with the `predicate`.
|
||||
*
|
||||
* @example <caption>Counts how many seconds have passed before the first click happened</caption>
|
||||
* var seconds = Rx.Observable.interval(1000);
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var secondsBeforeClick = seconds.takeUntil(clicks);
|
||||
* var result = secondsBeforeClick.count();
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @example <caption>Counts how many odd numbers are there between 1 and 7</caption>
|
||||
* var numbers = Rx.Observable.range(1, 7);
|
||||
* var result = numbers.count(i => i % 2 === 1);
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Results in:
|
||||
* // 4
|
||||
*
|
||||
* @see {@link max}
|
||||
* @see {@link min}
|
||||
* @see {@link reduce}
|
||||
*
|
||||
* @param {function(value: T, i: number, source: Observable<T>): boolean} [predicate] A
|
||||
* boolean function to select what values are to be counted. It is provided with
|
||||
* arguments of:
|
||||
* - `value`: the value from the source Observable.
|
||||
* - `index`: the (zero-based) "index" of the value from the source Observable.
|
||||
* - `source`: the source Observable instance itself.
|
||||
* @return {Observable} An Observable of one number that represents the count as
|
||||
* described above.
|
||||
* @method count
|
||||
* @owner Observable
|
||||
*/
|
||||
function count(predicate) {
|
||||
return function (source) { return source.lift(new CountOperator(predicate, source)); };
|
||||
}
|
||||
exports.count = count;
|
||||
var CountOperator = (function () {
|
||||
function CountOperator(predicate, source) {
|
||||
this.predicate = predicate;
|
||||
this.source = source;
|
||||
}
|
||||
CountOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new CountSubscriber(subscriber, this.predicate, this.source));
|
||||
};
|
||||
return CountOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var CountSubscriber = (function (_super) {
|
||||
__extends(CountSubscriber, _super);
|
||||
function CountSubscriber(destination, predicate, source) {
|
||||
_super.call(this, destination);
|
||||
this.predicate = predicate;
|
||||
this.source = source;
|
||||
this.count = 0;
|
||||
this.index = 0;
|
||||
}
|
||||
CountSubscriber.prototype._next = function (value) {
|
||||
if (this.predicate) {
|
||||
this._tryPredicate(value);
|
||||
}
|
||||
else {
|
||||
this.count++;
|
||||
}
|
||||
};
|
||||
CountSubscriber.prototype._tryPredicate = function (value) {
|
||||
var result;
|
||||
try {
|
||||
result = this.predicate(value, this.index++, this.source);
|
||||
}
|
||||
catch (err) {
|
||||
this.destination.error(err);
|
||||
return;
|
||||
}
|
||||
if (result) {
|
||||
this.count++;
|
||||
}
|
||||
};
|
||||
CountSubscriber.prototype._complete = function () {
|
||||
this.destination.next(this.count);
|
||||
this.destination.complete();
|
||||
};
|
||||
return CountSubscriber;
|
||||
}(Subscriber_1.Subscriber));
|
||||
//# sourceMappingURL=count.js.map
|
1
node_modules/rxjs/operators/count.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/count.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
45
node_modules/rxjs/operators/debounce.d.ts
generated
vendored
Normal file
45
node_modules/rxjs/operators/debounce.d.ts
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import { SubscribableOrPromise } from '../Observable';
|
||||
import { MonoTypeOperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* Emits a value from the source Observable only after a particular time span
|
||||
* determined by another Observable has passed without another source emission.
|
||||
*
|
||||
* <span class="informal">It's like {@link debounceTime}, but the time span of
|
||||
* emission silence is determined by a second Observable.</span>
|
||||
*
|
||||
* <img src="./img/debounce.png" width="100%">
|
||||
*
|
||||
* `debounce` delays values emitted by the source Observable, but drops previous
|
||||
* pending delayed emissions if a new value arrives on the source Observable.
|
||||
* This operator keeps track of the most recent value from the source
|
||||
* Observable, and spawns a duration Observable by calling the
|
||||
* `durationSelector` function. The value is emitted only when the duration
|
||||
* Observable emits a value or completes, and if no other value was emitted on
|
||||
* the source Observable since the duration Observable was spawned. If a new
|
||||
* value appears before the duration Observable emits, the previous value will
|
||||
* be dropped and will not be emitted on the output Observable.
|
||||
*
|
||||
* Like {@link debounceTime}, this is a rate-limiting operator, and also a
|
||||
* delay-like operator since output emissions do not necessarily occur at the
|
||||
* same time as they did on the source Observable.
|
||||
*
|
||||
* @example <caption>Emit the most recent click after a burst of clicks</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var result = clicks.debounce(() => Rx.Observable.interval(1000));
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link audit}
|
||||
* @see {@link debounceTime}
|
||||
* @see {@link delayWhen}
|
||||
* @see {@link throttle}
|
||||
*
|
||||
* @param {function(value: T): SubscribableOrPromise} durationSelector A function
|
||||
* that receives a value from the source Observable, for computing the timeout
|
||||
* duration for each source value, returned as an Observable or a Promise.
|
||||
* @return {Observable} An Observable that delays the emissions of the source
|
||||
* Observable by the specified duration Observable returned by
|
||||
* `durationSelector`, and may drop some values if they occur too frequently.
|
||||
* @method debounce
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function debounce<T>(durationSelector: (value: T) => SubscribableOrPromise<number>): MonoTypeOperatorFunction<T>;
|
127
node_modules/rxjs/operators/debounce.js
generated
vendored
Normal file
127
node_modules/rxjs/operators/debounce.js
generated
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||||
/**
|
||||
* Emits a value from the source Observable only after a particular time span
|
||||
* determined by another Observable has passed without another source emission.
|
||||
*
|
||||
* <span class="informal">It's like {@link debounceTime}, but the time span of
|
||||
* emission silence is determined by a second Observable.</span>
|
||||
*
|
||||
* <img src="./img/debounce.png" width="100%">
|
||||
*
|
||||
* `debounce` delays values emitted by the source Observable, but drops previous
|
||||
* pending delayed emissions if a new value arrives on the source Observable.
|
||||
* This operator keeps track of the most recent value from the source
|
||||
* Observable, and spawns a duration Observable by calling the
|
||||
* `durationSelector` function. The value is emitted only when the duration
|
||||
* Observable emits a value or completes, and if no other value was emitted on
|
||||
* the source Observable since the duration Observable was spawned. If a new
|
||||
* value appears before the duration Observable emits, the previous value will
|
||||
* be dropped and will not be emitted on the output Observable.
|
||||
*
|
||||
* Like {@link debounceTime}, this is a rate-limiting operator, and also a
|
||||
* delay-like operator since output emissions do not necessarily occur at the
|
||||
* same time as they did on the source Observable.
|
||||
*
|
||||
* @example <caption>Emit the most recent click after a burst of clicks</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var result = clicks.debounce(() => Rx.Observable.interval(1000));
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link audit}
|
||||
* @see {@link debounceTime}
|
||||
* @see {@link delayWhen}
|
||||
* @see {@link throttle}
|
||||
*
|
||||
* @param {function(value: T): SubscribableOrPromise} durationSelector A function
|
||||
* that receives a value from the source Observable, for computing the timeout
|
||||
* duration for each source value, returned as an Observable or a Promise.
|
||||
* @return {Observable} An Observable that delays the emissions of the source
|
||||
* Observable by the specified duration Observable returned by
|
||||
* `durationSelector`, and may drop some values if they occur too frequently.
|
||||
* @method debounce
|
||||
* @owner Observable
|
||||
*/
|
||||
function debounce(durationSelector) {
|
||||
return function (source) { return source.lift(new DebounceOperator(durationSelector)); };
|
||||
}
|
||||
exports.debounce = debounce;
|
||||
var DebounceOperator = (function () {
|
||||
function DebounceOperator(durationSelector) {
|
||||
this.durationSelector = durationSelector;
|
||||
}
|
||||
DebounceOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new DebounceSubscriber(subscriber, this.durationSelector));
|
||||
};
|
||||
return DebounceOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var DebounceSubscriber = (function (_super) {
|
||||
__extends(DebounceSubscriber, _super);
|
||||
function DebounceSubscriber(destination, durationSelector) {
|
||||
_super.call(this, destination);
|
||||
this.durationSelector = durationSelector;
|
||||
this.hasValue = false;
|
||||
this.durationSubscription = null;
|
||||
}
|
||||
DebounceSubscriber.prototype._next = function (value) {
|
||||
try {
|
||||
var result = this.durationSelector.call(this, value);
|
||||
if (result) {
|
||||
this._tryNext(value, result);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
this.destination.error(err);
|
||||
}
|
||||
};
|
||||
DebounceSubscriber.prototype._complete = function () {
|
||||
this.emitValue();
|
||||
this.destination.complete();
|
||||
};
|
||||
DebounceSubscriber.prototype._tryNext = function (value, duration) {
|
||||
var subscription = this.durationSubscription;
|
||||
this.value = value;
|
||||
this.hasValue = true;
|
||||
if (subscription) {
|
||||
subscription.unsubscribe();
|
||||
this.remove(subscription);
|
||||
}
|
||||
subscription = subscribeToResult_1.subscribeToResult(this, duration);
|
||||
if (!subscription.closed) {
|
||||
this.add(this.durationSubscription = subscription);
|
||||
}
|
||||
};
|
||||
DebounceSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
|
||||
this.emitValue();
|
||||
};
|
||||
DebounceSubscriber.prototype.notifyComplete = function () {
|
||||
this.emitValue();
|
||||
};
|
||||
DebounceSubscriber.prototype.emitValue = function () {
|
||||
if (this.hasValue) {
|
||||
var value = this.value;
|
||||
var subscription = this.durationSubscription;
|
||||
if (subscription) {
|
||||
this.durationSubscription = null;
|
||||
subscription.unsubscribe();
|
||||
this.remove(subscription);
|
||||
}
|
||||
this.value = null;
|
||||
this.hasValue = false;
|
||||
_super.prototype._next.call(this, value);
|
||||
}
|
||||
};
|
||||
return DebounceSubscriber;
|
||||
}(OuterSubscriber_1.OuterSubscriber));
|
||||
//# sourceMappingURL=debounce.js.map
|
1
node_modules/rxjs/operators/debounce.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/debounce.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
49
node_modules/rxjs/operators/debounceTime.d.ts
generated
vendored
Normal file
49
node_modules/rxjs/operators/debounceTime.d.ts
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { MonoTypeOperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* Emits a value from the source Observable only after a particular time span
|
||||
* has passed without another source emission.
|
||||
*
|
||||
* <span class="informal">It's like {@link delay}, but passes only the most
|
||||
* recent value from each burst of emissions.</span>
|
||||
*
|
||||
* <img src="./img/debounceTime.png" width="100%">
|
||||
*
|
||||
* `debounceTime` delays values emitted by the source Observable, but drops
|
||||
* previous pending delayed emissions if a new value arrives on the source
|
||||
* Observable. This operator keeps track of the most recent value from the
|
||||
* source Observable, and emits that only when `dueTime` enough time has passed
|
||||
* without any other value appearing on the source Observable. If a new value
|
||||
* appears before `dueTime` silence occurs, the previous value will be dropped
|
||||
* and will not be emitted on the output Observable.
|
||||
*
|
||||
* This is a rate-limiting operator, because it is impossible for more than one
|
||||
* value to be emitted in any time window of duration `dueTime`, but it is also
|
||||
* a delay-like operator since output emissions do not occur at the same time as
|
||||
* they did on the source Observable. Optionally takes a {@link IScheduler} for
|
||||
* managing timers.
|
||||
*
|
||||
* @example <caption>Emit the most recent click after a burst of clicks</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var result = clicks.debounceTime(1000);
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link auditTime}
|
||||
* @see {@link debounce}
|
||||
* @see {@link delay}
|
||||
* @see {@link sampleTime}
|
||||
* @see {@link throttleTime}
|
||||
*
|
||||
* @param {number} dueTime The timeout duration in milliseconds (or the time
|
||||
* unit determined internally by the optional `scheduler`) for the window of
|
||||
* time required to wait for emission silence before emitting the most recent
|
||||
* source value.
|
||||
* @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for
|
||||
* managing the timers that handle the timeout for each value.
|
||||
* @return {Observable} An Observable that delays the emissions of the source
|
||||
* Observable by the specified `dueTime`, and may drop some values if they occur
|
||||
* too frequently.
|
||||
* @method debounceTime
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function debounceTime<T>(dueTime: number, scheduler?: IScheduler): MonoTypeOperatorFunction<T>;
|
116
node_modules/rxjs/operators/debounceTime.js
generated
vendored
Normal file
116
node_modules/rxjs/operators/debounceTime.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Subscriber_1 = require('../Subscriber');
|
||||
var async_1 = require('../scheduler/async');
|
||||
/**
|
||||
* Emits a value from the source Observable only after a particular time span
|
||||
* has passed without another source emission.
|
||||
*
|
||||
* <span class="informal">It's like {@link delay}, but passes only the most
|
||||
* recent value from each burst of emissions.</span>
|
||||
*
|
||||
* <img src="./img/debounceTime.png" width="100%">
|
||||
*
|
||||
* `debounceTime` delays values emitted by the source Observable, but drops
|
||||
* previous pending delayed emissions if a new value arrives on the source
|
||||
* Observable. This operator keeps track of the most recent value from the
|
||||
* source Observable, and emits that only when `dueTime` enough time has passed
|
||||
* without any other value appearing on the source Observable. If a new value
|
||||
* appears before `dueTime` silence occurs, the previous value will be dropped
|
||||
* and will not be emitted on the output Observable.
|
||||
*
|
||||
* This is a rate-limiting operator, because it is impossible for more than one
|
||||
* value to be emitted in any time window of duration `dueTime`, but it is also
|
||||
* a delay-like operator since output emissions do not occur at the same time as
|
||||
* they did on the source Observable. Optionally takes a {@link IScheduler} for
|
||||
* managing timers.
|
||||
*
|
||||
* @example <caption>Emit the most recent click after a burst of clicks</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var result = clicks.debounceTime(1000);
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link auditTime}
|
||||
* @see {@link debounce}
|
||||
* @see {@link delay}
|
||||
* @see {@link sampleTime}
|
||||
* @see {@link throttleTime}
|
||||
*
|
||||
* @param {number} dueTime The timeout duration in milliseconds (or the time
|
||||
* unit determined internally by the optional `scheduler`) for the window of
|
||||
* time required to wait for emission silence before emitting the most recent
|
||||
* source value.
|
||||
* @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for
|
||||
* managing the timers that handle the timeout for each value.
|
||||
* @return {Observable} An Observable that delays the emissions of the source
|
||||
* Observable by the specified `dueTime`, and may drop some values if they occur
|
||||
* too frequently.
|
||||
* @method debounceTime
|
||||
* @owner Observable
|
||||
*/
|
||||
function debounceTime(dueTime, scheduler) {
|
||||
if (scheduler === void 0) { scheduler = async_1.async; }
|
||||
return function (source) { return source.lift(new DebounceTimeOperator(dueTime, scheduler)); };
|
||||
}
|
||||
exports.debounceTime = debounceTime;
|
||||
var DebounceTimeOperator = (function () {
|
||||
function DebounceTimeOperator(dueTime, scheduler) {
|
||||
this.dueTime = dueTime;
|
||||
this.scheduler = scheduler;
|
||||
}
|
||||
DebounceTimeOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new DebounceTimeSubscriber(subscriber, this.dueTime, this.scheduler));
|
||||
};
|
||||
return DebounceTimeOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var DebounceTimeSubscriber = (function (_super) {
|
||||
__extends(DebounceTimeSubscriber, _super);
|
||||
function DebounceTimeSubscriber(destination, dueTime, scheduler) {
|
||||
_super.call(this, destination);
|
||||
this.dueTime = dueTime;
|
||||
this.scheduler = scheduler;
|
||||
this.debouncedSubscription = null;
|
||||
this.lastValue = null;
|
||||
this.hasValue = false;
|
||||
}
|
||||
DebounceTimeSubscriber.prototype._next = function (value) {
|
||||
this.clearDebounce();
|
||||
this.lastValue = value;
|
||||
this.hasValue = true;
|
||||
this.add(this.debouncedSubscription = this.scheduler.schedule(dispatchNext, this.dueTime, this));
|
||||
};
|
||||
DebounceTimeSubscriber.prototype._complete = function () {
|
||||
this.debouncedNext();
|
||||
this.destination.complete();
|
||||
};
|
||||
DebounceTimeSubscriber.prototype.debouncedNext = function () {
|
||||
this.clearDebounce();
|
||||
if (this.hasValue) {
|
||||
this.destination.next(this.lastValue);
|
||||
this.lastValue = null;
|
||||
this.hasValue = false;
|
||||
}
|
||||
};
|
||||
DebounceTimeSubscriber.prototype.clearDebounce = function () {
|
||||
var debouncedSubscription = this.debouncedSubscription;
|
||||
if (debouncedSubscription !== null) {
|
||||
this.remove(debouncedSubscription);
|
||||
debouncedSubscription.unsubscribe();
|
||||
this.debouncedSubscription = null;
|
||||
}
|
||||
};
|
||||
return DebounceTimeSubscriber;
|
||||
}(Subscriber_1.Subscriber));
|
||||
function dispatchNext(subscriber) {
|
||||
subscriber.debouncedNext();
|
||||
}
|
||||
//# sourceMappingURL=debounceTime.js.map
|
1
node_modules/rxjs/operators/debounceTime.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/debounceTime.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/rxjs/operators/defaultIfEmpty.d.ts
generated
vendored
Normal file
3
node_modules/rxjs/operators/defaultIfEmpty.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { OperatorFunction, MonoTypeOperatorFunction } from '../interfaces';
|
||||
export declare function defaultIfEmpty<T>(defaultValue?: T): MonoTypeOperatorFunction<T>;
|
||||
export declare function defaultIfEmpty<T, R>(defaultValue?: R): OperatorFunction<T, T | R>;
|
77
node_modules/rxjs/operators/defaultIfEmpty.js
generated
vendored
Normal file
77
node_modules/rxjs/operators/defaultIfEmpty.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Subscriber_1 = require('../Subscriber');
|
||||
/* tslint:enable:max-line-length */
|
||||
/**
|
||||
* Emits a given value if the source Observable completes without emitting any
|
||||
* `next` value, otherwise mirrors the source Observable.
|
||||
*
|
||||
* <span class="informal">If the source Observable turns out to be empty, then
|
||||
* this operator will emit a default value.</span>
|
||||
*
|
||||
* <img src="./img/defaultIfEmpty.png" width="100%">
|
||||
*
|
||||
* `defaultIfEmpty` emits the values emitted by the source Observable or a
|
||||
* specified default value if the source Observable is empty (completes without
|
||||
* having emitted any `next` value).
|
||||
*
|
||||
* @example <caption>If no clicks happen in 5 seconds, then emit "no clicks"</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var clicksBeforeFive = clicks.takeUntil(Rx.Observable.interval(5000));
|
||||
* var result = clicksBeforeFive.defaultIfEmpty('no clicks');
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link empty}
|
||||
* @see {@link last}
|
||||
*
|
||||
* @param {any} [defaultValue=null] The default value used if the source
|
||||
* Observable is empty.
|
||||
* @return {Observable} An Observable that emits either the specified
|
||||
* `defaultValue` if the source Observable emits no items, or the values emitted
|
||||
* by the source Observable.
|
||||
* @method defaultIfEmpty
|
||||
* @owner Observable
|
||||
*/
|
||||
function defaultIfEmpty(defaultValue) {
|
||||
if (defaultValue === void 0) { defaultValue = null; }
|
||||
return function (source) { return source.lift(new DefaultIfEmptyOperator(defaultValue)); };
|
||||
}
|
||||
exports.defaultIfEmpty = defaultIfEmpty;
|
||||
var DefaultIfEmptyOperator = (function () {
|
||||
function DefaultIfEmptyOperator(defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
DefaultIfEmptyOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new DefaultIfEmptySubscriber(subscriber, this.defaultValue));
|
||||
};
|
||||
return DefaultIfEmptyOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var DefaultIfEmptySubscriber = (function (_super) {
|
||||
__extends(DefaultIfEmptySubscriber, _super);
|
||||
function DefaultIfEmptySubscriber(destination, defaultValue) {
|
||||
_super.call(this, destination);
|
||||
this.defaultValue = defaultValue;
|
||||
this.isEmpty = true;
|
||||
}
|
||||
DefaultIfEmptySubscriber.prototype._next = function (value) {
|
||||
this.isEmpty = false;
|
||||
this.destination.next(value);
|
||||
};
|
||||
DefaultIfEmptySubscriber.prototype._complete = function () {
|
||||
if (this.isEmpty) {
|
||||
this.destination.next(this.defaultValue);
|
||||
}
|
||||
this.destination.complete();
|
||||
};
|
||||
return DefaultIfEmptySubscriber;
|
||||
}(Subscriber_1.Subscriber));
|
||||
//# sourceMappingURL=defaultIfEmpty.js.map
|
1
node_modules/rxjs/operators/defaultIfEmpty.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/defaultIfEmpty.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"defaultIfEmpty.js","sourceRoot":"","sources":["../../src/operators/defaultIfEmpty.ts"],"names":[],"mappings":";;;;;;AAEA,2BAA2B,eAAe,CAAC,CAAA;AAM3C,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAqC,YAAsB;IAAtB,4BAAsB,GAAtB,mBAAsB;IACzD,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,sBAAsB,CAAC,YAAY,CAAC,CAAsB,EAA1E,CAA0E,CAAC;AAC/G,CAAC;AAFe,sBAAc,iBAE7B,CAAA;AAED;IAEE,gCAAoB,YAAe;QAAf,iBAAY,GAAZ,YAAY,CAAG;IACnC,CAAC;IAED,qCAAI,GAAJ,UAAK,UAA6B,EAAE,MAAW;QAC7C,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,wBAAwB,CAAC,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IACvF,CAAC;IACH,6BAAC;AAAD,CAAC,AARD,IAQC;AAED;;;;GAIG;AACH;IAA6C,4CAAa;IAGxD,kCAAY,WAA8B,EAAU,YAAe;QACjE,kBAAM,WAAW,CAAC,CAAC;QAD+B,iBAAY,GAAZ,YAAY,CAAG;QAF3D,YAAO,GAAY,IAAI,CAAC;IAIhC,CAAC;IAES,wCAAK,GAAf,UAAgB,KAAQ;QACtB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAES,4CAAS,GAAnB;QACE,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;YACjB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3C,CAAC;QACD,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;IAC9B,CAAC;IACH,+BAAC;AAAD,CAAC,AAlBD,CAA6C,uBAAU,GAkBtD","sourcesContent":["import { Operator } from '../Operator';\nimport { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { OperatorFunction, MonoTypeOperatorFunction } from '../interfaces';\n\n/* tslint:disable:max-line-length */\nexport function defaultIfEmpty<T>(defaultValue?: T): MonoTypeOperatorFunction<T>;\nexport function defaultIfEmpty<T, R>(defaultValue?: R): OperatorFunction<T, T | R>;\n/* tslint:enable:max-line-length */\n\n/**\n * Emits a given value if the source Observable completes without emitting any\n * `next` value, otherwise mirrors the source Observable.\n *\n * <span class=\"informal\">If the source Observable turns out to be empty, then\n * this operator will emit a default value.</span>\n *\n * <img src=\"./img/defaultIfEmpty.png\" width=\"100%\">\n *\n * `defaultIfEmpty` emits the values emitted by the source Observable or a\n * specified default value if the source Observable is empty (completes without\n * having emitted any `next` value).\n *\n * @example <caption>If no clicks happen in 5 seconds, then emit \"no clicks\"</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var clicksBeforeFive = clicks.takeUntil(Rx.Observable.interval(5000));\n * var result = clicksBeforeFive.defaultIfEmpty('no clicks');\n * result.subscribe(x => console.log(x));\n *\n * @see {@link empty}\n * @see {@link last}\n *\n * @param {any} [defaultValue=null] The default value used if the source\n * Observable is empty.\n * @return {Observable} An Observable that emits either the specified\n * `defaultValue` if the source Observable emits no items, or the values emitted\n * by the source Observable.\n * @method defaultIfEmpty\n * @owner Observable\n */\nexport function defaultIfEmpty<T, R>(defaultValue: R = null): OperatorFunction<T, T | R> {\n return (source: Observable<T>) => source.lift(new DefaultIfEmptyOperator(defaultValue)) as Observable<T | R>;\n}\n\nclass DefaultIfEmptyOperator<T, R> implements Operator<T, T | R> {\n\n constructor(private defaultValue: R) {\n }\n\n call(subscriber: Subscriber<T | R>, source: any): any {\n return source.subscribe(new DefaultIfEmptySubscriber(subscriber, this.defaultValue));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass DefaultIfEmptySubscriber<T, R> extends Subscriber<T> {\n private isEmpty: boolean = true;\n\n constructor(destination: Subscriber<T | R>, private defaultValue: R) {\n super(destination);\n }\n\n protected _next(value: T): void {\n this.isEmpty = false;\n this.destination.next(value);\n }\n\n protected _complete(): void {\n if (this.isEmpty) {\n this.destination.next(this.defaultValue);\n }\n this.destination.complete();\n }\n}"]}
|
42
node_modules/rxjs/operators/delay.d.ts
generated
vendored
Normal file
42
node_modules/rxjs/operators/delay.d.ts
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { MonoTypeOperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* Delays the emission of items from the source Observable by a given timeout or
|
||||
* until a given Date.
|
||||
*
|
||||
* <span class="informal">Time shifts each item by some specified amount of
|
||||
* milliseconds.</span>
|
||||
*
|
||||
* <img src="./img/delay.png" width="100%">
|
||||
*
|
||||
* If the delay argument is a Number, this operator time shifts the source
|
||||
* Observable by that amount of time expressed in milliseconds. The relative
|
||||
* time intervals between the values are preserved.
|
||||
*
|
||||
* If the delay argument is a Date, this operator time shifts the start of the
|
||||
* Observable execution until the given date occurs.
|
||||
*
|
||||
* @example <caption>Delay each click by one second</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var delayedClicks = clicks.delay(1000); // each click emitted after 1 second
|
||||
* delayedClicks.subscribe(x => console.log(x));
|
||||
*
|
||||
* @example <caption>Delay all clicks until a future date happens</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var date = new Date('March 15, 2050 12:00:00'); // in the future
|
||||
* var delayedClicks = clicks.delay(date); // click emitted only after that date
|
||||
* delayedClicks.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link debounceTime}
|
||||
* @see {@link delayWhen}
|
||||
*
|
||||
* @param {number|Date} delay The delay duration in milliseconds (a `number`) or
|
||||
* a `Date` until which the emission of the source items is delayed.
|
||||
* @param {Scheduler} [scheduler=async] The IScheduler to use for
|
||||
* managing the timers that handle the time-shift for each item.
|
||||
* @return {Observable} An Observable that delays the emissions of the source
|
||||
* Observable by the specified timeout or Date.
|
||||
* @method delay
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function delay<T>(delay: number | Date, scheduler?: IScheduler): MonoTypeOperatorFunction<T>;
|
136
node_modules/rxjs/operators/delay.js
generated
vendored
Normal file
136
node_modules/rxjs/operators/delay.js
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var async_1 = require('../scheduler/async');
|
||||
var isDate_1 = require('../util/isDate');
|
||||
var Subscriber_1 = require('../Subscriber');
|
||||
var Notification_1 = require('../Notification');
|
||||
/**
|
||||
* Delays the emission of items from the source Observable by a given timeout or
|
||||
* until a given Date.
|
||||
*
|
||||
* <span class="informal">Time shifts each item by some specified amount of
|
||||
* milliseconds.</span>
|
||||
*
|
||||
* <img src="./img/delay.png" width="100%">
|
||||
*
|
||||
* If the delay argument is a Number, this operator time shifts the source
|
||||
* Observable by that amount of time expressed in milliseconds. The relative
|
||||
* time intervals between the values are preserved.
|
||||
*
|
||||
* If the delay argument is a Date, this operator time shifts the start of the
|
||||
* Observable execution until the given date occurs.
|
||||
*
|
||||
* @example <caption>Delay each click by one second</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var delayedClicks = clicks.delay(1000); // each click emitted after 1 second
|
||||
* delayedClicks.subscribe(x => console.log(x));
|
||||
*
|
||||
* @example <caption>Delay all clicks until a future date happens</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var date = new Date('March 15, 2050 12:00:00'); // in the future
|
||||
* var delayedClicks = clicks.delay(date); // click emitted only after that date
|
||||
* delayedClicks.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link debounceTime}
|
||||
* @see {@link delayWhen}
|
||||
*
|
||||
* @param {number|Date} delay The delay duration in milliseconds (a `number`) or
|
||||
* a `Date` until which the emission of the source items is delayed.
|
||||
* @param {Scheduler} [scheduler=async] The IScheduler to use for
|
||||
* managing the timers that handle the time-shift for each item.
|
||||
* @return {Observable} An Observable that delays the emissions of the source
|
||||
* Observable by the specified timeout or Date.
|
||||
* @method delay
|
||||
* @owner Observable
|
||||
*/
|
||||
function delay(delay, scheduler) {
|
||||
if (scheduler === void 0) { scheduler = async_1.async; }
|
||||
var absoluteDelay = isDate_1.isDate(delay);
|
||||
var delayFor = absoluteDelay ? (+delay - scheduler.now()) : Math.abs(delay);
|
||||
return function (source) { return source.lift(new DelayOperator(delayFor, scheduler)); };
|
||||
}
|
||||
exports.delay = delay;
|
||||
var DelayOperator = (function () {
|
||||
function DelayOperator(delay, scheduler) {
|
||||
this.delay = delay;
|
||||
this.scheduler = scheduler;
|
||||
}
|
||||
DelayOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new DelaySubscriber(subscriber, this.delay, this.scheduler));
|
||||
};
|
||||
return DelayOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var DelaySubscriber = (function (_super) {
|
||||
__extends(DelaySubscriber, _super);
|
||||
function DelaySubscriber(destination, delay, scheduler) {
|
||||
_super.call(this, destination);
|
||||
this.delay = delay;
|
||||
this.scheduler = scheduler;
|
||||
this.queue = [];
|
||||
this.active = false;
|
||||
this.errored = false;
|
||||
}
|
||||
DelaySubscriber.dispatch = function (state) {
|
||||
var source = state.source;
|
||||
var queue = source.queue;
|
||||
var scheduler = state.scheduler;
|
||||
var destination = state.destination;
|
||||
while (queue.length > 0 && (queue[0].time - scheduler.now()) <= 0) {
|
||||
queue.shift().notification.observe(destination);
|
||||
}
|
||||
if (queue.length > 0) {
|
||||
var delay_1 = Math.max(0, queue[0].time - scheduler.now());
|
||||
this.schedule(state, delay_1);
|
||||
}
|
||||
else {
|
||||
this.unsubscribe();
|
||||
source.active = false;
|
||||
}
|
||||
};
|
||||
DelaySubscriber.prototype._schedule = function (scheduler) {
|
||||
this.active = true;
|
||||
this.add(scheduler.schedule(DelaySubscriber.dispatch, this.delay, {
|
||||
source: this, destination: this.destination, scheduler: scheduler
|
||||
}));
|
||||
};
|
||||
DelaySubscriber.prototype.scheduleNotification = function (notification) {
|
||||
if (this.errored === true) {
|
||||
return;
|
||||
}
|
||||
var scheduler = this.scheduler;
|
||||
var message = new DelayMessage(scheduler.now() + this.delay, notification);
|
||||
this.queue.push(message);
|
||||
if (this.active === false) {
|
||||
this._schedule(scheduler);
|
||||
}
|
||||
};
|
||||
DelaySubscriber.prototype._next = function (value) {
|
||||
this.scheduleNotification(Notification_1.Notification.createNext(value));
|
||||
};
|
||||
DelaySubscriber.prototype._error = function (err) {
|
||||
this.errored = true;
|
||||
this.queue = [];
|
||||
this.destination.error(err);
|
||||
};
|
||||
DelaySubscriber.prototype._complete = function () {
|
||||
this.scheduleNotification(Notification_1.Notification.createComplete());
|
||||
};
|
||||
return DelaySubscriber;
|
||||
}(Subscriber_1.Subscriber));
|
||||
var DelayMessage = (function () {
|
||||
function DelayMessage(time, notification) {
|
||||
this.time = time;
|
||||
this.notification = notification;
|
||||
}
|
||||
return DelayMessage;
|
||||
}());
|
||||
//# sourceMappingURL=delay.js.map
|
1
node_modules/rxjs/operators/delay.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/delay.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
48
node_modules/rxjs/operators/delayWhen.d.ts
generated
vendored
Normal file
48
node_modules/rxjs/operators/delayWhen.d.ts
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { MonoTypeOperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* Delays the emission of items from the source Observable by a given time span
|
||||
* determined by the emissions of another Observable.
|
||||
*
|
||||
* <span class="informal">It's like {@link delay}, but the time span of the
|
||||
* delay duration is determined by a second Observable.</span>
|
||||
*
|
||||
* <img src="./img/delayWhen.png" width="100%">
|
||||
*
|
||||
* `delayWhen` time shifts each emitted value from the source Observable by a
|
||||
* time span determined by another Observable. When the source emits a value,
|
||||
* the `delayDurationSelector` function is called with the source value as
|
||||
* argument, and should return an Observable, called the "duration" Observable.
|
||||
* The source value is emitted on the output Observable only when the duration
|
||||
* Observable emits a value or completes.
|
||||
*
|
||||
* Optionally, `delayWhen` takes a second argument, `subscriptionDelay`, which
|
||||
* is an Observable. When `subscriptionDelay` emits its first value or
|
||||
* completes, the source Observable is subscribed to and starts behaving like
|
||||
* described in the previous paragraph. If `subscriptionDelay` is not provided,
|
||||
* `delayWhen` will subscribe to the source Observable as soon as the output
|
||||
* Observable is subscribed.
|
||||
*
|
||||
* @example <caption>Delay each click by a random amount of time, between 0 and 5 seconds</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var delayedClicks = clicks.delayWhen(event =>
|
||||
* Rx.Observable.interval(Math.random() * 5000)
|
||||
* );
|
||||
* delayedClicks.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link debounce}
|
||||
* @see {@link delay}
|
||||
*
|
||||
* @param {function(value: T): Observable} delayDurationSelector A function that
|
||||
* returns an Observable for each value emitted by the source Observable, which
|
||||
* is then used to delay the emission of that item on the output Observable
|
||||
* until the Observable returned from this function emits a value.
|
||||
* @param {Observable} subscriptionDelay An Observable that triggers the
|
||||
* subscription to the source Observable once it emits any value.
|
||||
* @return {Observable} An Observable that delays the emissions of the source
|
||||
* Observable by an amount of time specified by the Observable returned by
|
||||
* `delayDurationSelector`.
|
||||
* @method delayWhen
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function delayWhen<T>(delayDurationSelector: (value: T) => Observable<any>, subscriptionDelay?: Observable<any>): MonoTypeOperatorFunction<T>;
|
194
node_modules/rxjs/operators/delayWhen.js
generated
vendored
Normal file
194
node_modules/rxjs/operators/delayWhen.js
generated
vendored
Normal file
@@ -0,0 +1,194 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Subscriber_1 = require('../Subscriber');
|
||||
var Observable_1 = require('../Observable');
|
||||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||||
/**
|
||||
* Delays the emission of items from the source Observable by a given time span
|
||||
* determined by the emissions of another Observable.
|
||||
*
|
||||
* <span class="informal">It's like {@link delay}, but the time span of the
|
||||
* delay duration is determined by a second Observable.</span>
|
||||
*
|
||||
* <img src="./img/delayWhen.png" width="100%">
|
||||
*
|
||||
* `delayWhen` time shifts each emitted value from the source Observable by a
|
||||
* time span determined by another Observable. When the source emits a value,
|
||||
* the `delayDurationSelector` function is called with the source value as
|
||||
* argument, and should return an Observable, called the "duration" Observable.
|
||||
* The source value is emitted on the output Observable only when the duration
|
||||
* Observable emits a value or completes.
|
||||
*
|
||||
* Optionally, `delayWhen` takes a second argument, `subscriptionDelay`, which
|
||||
* is an Observable. When `subscriptionDelay` emits its first value or
|
||||
* completes, the source Observable is subscribed to and starts behaving like
|
||||
* described in the previous paragraph. If `subscriptionDelay` is not provided,
|
||||
* `delayWhen` will subscribe to the source Observable as soon as the output
|
||||
* Observable is subscribed.
|
||||
*
|
||||
* @example <caption>Delay each click by a random amount of time, between 0 and 5 seconds</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var delayedClicks = clicks.delayWhen(event =>
|
||||
* Rx.Observable.interval(Math.random() * 5000)
|
||||
* );
|
||||
* delayedClicks.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link debounce}
|
||||
* @see {@link delay}
|
||||
*
|
||||
* @param {function(value: T): Observable} delayDurationSelector A function that
|
||||
* returns an Observable for each value emitted by the source Observable, which
|
||||
* is then used to delay the emission of that item on the output Observable
|
||||
* until the Observable returned from this function emits a value.
|
||||
* @param {Observable} subscriptionDelay An Observable that triggers the
|
||||
* subscription to the source Observable once it emits any value.
|
||||
* @return {Observable} An Observable that delays the emissions of the source
|
||||
* Observable by an amount of time specified by the Observable returned by
|
||||
* `delayDurationSelector`.
|
||||
* @method delayWhen
|
||||
* @owner Observable
|
||||
*/
|
||||
function delayWhen(delayDurationSelector, subscriptionDelay) {
|
||||
if (subscriptionDelay) {
|
||||
return function (source) {
|
||||
return new SubscriptionDelayObservable(source, subscriptionDelay)
|
||||
.lift(new DelayWhenOperator(delayDurationSelector));
|
||||
};
|
||||
}
|
||||
return function (source) { return source.lift(new DelayWhenOperator(delayDurationSelector)); };
|
||||
}
|
||||
exports.delayWhen = delayWhen;
|
||||
var DelayWhenOperator = (function () {
|
||||
function DelayWhenOperator(delayDurationSelector) {
|
||||
this.delayDurationSelector = delayDurationSelector;
|
||||
}
|
||||
DelayWhenOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new DelayWhenSubscriber(subscriber, this.delayDurationSelector));
|
||||
};
|
||||
return DelayWhenOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var DelayWhenSubscriber = (function (_super) {
|
||||
__extends(DelayWhenSubscriber, _super);
|
||||
function DelayWhenSubscriber(destination, delayDurationSelector) {
|
||||
_super.call(this, destination);
|
||||
this.delayDurationSelector = delayDurationSelector;
|
||||
this.completed = false;
|
||||
this.delayNotifierSubscriptions = [];
|
||||
this.values = [];
|
||||
}
|
||||
DelayWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
|
||||
this.destination.next(outerValue);
|
||||
this.removeSubscription(innerSub);
|
||||
this.tryComplete();
|
||||
};
|
||||
DelayWhenSubscriber.prototype.notifyError = function (error, innerSub) {
|
||||
this._error(error);
|
||||
};
|
||||
DelayWhenSubscriber.prototype.notifyComplete = function (innerSub) {
|
||||
var value = this.removeSubscription(innerSub);
|
||||
if (value) {
|
||||
this.destination.next(value);
|
||||
}
|
||||
this.tryComplete();
|
||||
};
|
||||
DelayWhenSubscriber.prototype._next = function (value) {
|
||||
try {
|
||||
var delayNotifier = this.delayDurationSelector(value);
|
||||
if (delayNotifier) {
|
||||
this.tryDelay(delayNotifier, value);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
this.destination.error(err);
|
||||
}
|
||||
};
|
||||
DelayWhenSubscriber.prototype._complete = function () {
|
||||
this.completed = true;
|
||||
this.tryComplete();
|
||||
};
|
||||
DelayWhenSubscriber.prototype.removeSubscription = function (subscription) {
|
||||
subscription.unsubscribe();
|
||||
var subscriptionIdx = this.delayNotifierSubscriptions.indexOf(subscription);
|
||||
var value = null;
|
||||
if (subscriptionIdx !== -1) {
|
||||
value = this.values[subscriptionIdx];
|
||||
this.delayNotifierSubscriptions.splice(subscriptionIdx, 1);
|
||||
this.values.splice(subscriptionIdx, 1);
|
||||
}
|
||||
return value;
|
||||
};
|
||||
DelayWhenSubscriber.prototype.tryDelay = function (delayNotifier, value) {
|
||||
var notifierSubscription = subscribeToResult_1.subscribeToResult(this, delayNotifier, value);
|
||||
if (notifierSubscription && !notifierSubscription.closed) {
|
||||
this.add(notifierSubscription);
|
||||
this.delayNotifierSubscriptions.push(notifierSubscription);
|
||||
}
|
||||
this.values.push(value);
|
||||
};
|
||||
DelayWhenSubscriber.prototype.tryComplete = function () {
|
||||
if (this.completed && this.delayNotifierSubscriptions.length === 0) {
|
||||
this.destination.complete();
|
||||
}
|
||||
};
|
||||
return DelayWhenSubscriber;
|
||||
}(OuterSubscriber_1.OuterSubscriber));
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var SubscriptionDelayObservable = (function (_super) {
|
||||
__extends(SubscriptionDelayObservable, _super);
|
||||
function SubscriptionDelayObservable(/** @deprecated internal use only */ source, subscriptionDelay) {
|
||||
_super.call(this);
|
||||
this.source = source;
|
||||
this.subscriptionDelay = subscriptionDelay;
|
||||
}
|
||||
/** @deprecated internal use only */ SubscriptionDelayObservable.prototype._subscribe = function (subscriber) {
|
||||
this.subscriptionDelay.subscribe(new SubscriptionDelaySubscriber(subscriber, this.source));
|
||||
};
|
||||
return SubscriptionDelayObservable;
|
||||
}(Observable_1.Observable));
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var SubscriptionDelaySubscriber = (function (_super) {
|
||||
__extends(SubscriptionDelaySubscriber, _super);
|
||||
function SubscriptionDelaySubscriber(parent, source) {
|
||||
_super.call(this);
|
||||
this.parent = parent;
|
||||
this.source = source;
|
||||
this.sourceSubscribed = false;
|
||||
}
|
||||
SubscriptionDelaySubscriber.prototype._next = function (unused) {
|
||||
this.subscribeToSource();
|
||||
};
|
||||
SubscriptionDelaySubscriber.prototype._error = function (err) {
|
||||
this.unsubscribe();
|
||||
this.parent.error(err);
|
||||
};
|
||||
SubscriptionDelaySubscriber.prototype._complete = function () {
|
||||
this.subscribeToSource();
|
||||
};
|
||||
SubscriptionDelaySubscriber.prototype.subscribeToSource = function () {
|
||||
if (!this.sourceSubscribed) {
|
||||
this.sourceSubscribed = true;
|
||||
this.unsubscribe();
|
||||
this.source.subscribe(this.parent);
|
||||
}
|
||||
};
|
||||
return SubscriptionDelaySubscriber;
|
||||
}(Subscriber_1.Subscriber));
|
||||
//# sourceMappingURL=delayWhen.js.map
|
1
node_modules/rxjs/operators/delayWhen.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/delayWhen.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
43
node_modules/rxjs/operators/dematerialize.d.ts
generated
vendored
Normal file
43
node_modules/rxjs/operators/dematerialize.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import { Notification } from '../Notification';
|
||||
import { OperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* Converts an Observable of {@link Notification} objects into the emissions
|
||||
* that they represent.
|
||||
*
|
||||
* <span class="informal">Unwraps {@link Notification} objects as actual `next`,
|
||||
* `error` and `complete` emissions. The opposite of {@link materialize}.</span>
|
||||
*
|
||||
* <img src="./img/dematerialize.png" width="100%">
|
||||
*
|
||||
* `dematerialize` is assumed to operate an Observable that only emits
|
||||
* {@link Notification} objects as `next` emissions, and does not emit any
|
||||
* `error`. Such Observable is the output of a `materialize` operation. Those
|
||||
* notifications are then unwrapped using the metadata they contain, and emitted
|
||||
* as `next`, `error`, and `complete` on the output Observable.
|
||||
*
|
||||
* Use this operator in conjunction with {@link materialize}.
|
||||
*
|
||||
* @example <caption>Convert an Observable of Notifications to an actual Observable</caption>
|
||||
* var notifA = new Rx.Notification('N', 'A');
|
||||
* var notifB = new Rx.Notification('N', 'B');
|
||||
* var notifE = new Rx.Notification('E', void 0,
|
||||
* new TypeError('x.toUpperCase is not a function')
|
||||
* );
|
||||
* var materialized = Rx.Observable.of(notifA, notifB, notifE);
|
||||
* var upperCase = materialized.dematerialize();
|
||||
* upperCase.subscribe(x => console.log(x), e => console.error(e));
|
||||
*
|
||||
* // Results in:
|
||||
* // A
|
||||
* // B
|
||||
* // TypeError: x.toUpperCase is not a function
|
||||
*
|
||||
* @see {@link Notification}
|
||||
* @see {@link materialize}
|
||||
*
|
||||
* @return {Observable} An Observable that emits items and notifications
|
||||
* embedded in Notification objects emitted by the source Observable.
|
||||
* @method dematerialize
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function dematerialize<T>(): OperatorFunction<Notification<T>, T>;
|
77
node_modules/rxjs/operators/dematerialize.js
generated
vendored
Normal file
77
node_modules/rxjs/operators/dematerialize.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Subscriber_1 = require('../Subscriber');
|
||||
/**
|
||||
* Converts an Observable of {@link Notification} objects into the emissions
|
||||
* that they represent.
|
||||
*
|
||||
* <span class="informal">Unwraps {@link Notification} objects as actual `next`,
|
||||
* `error` and `complete` emissions. The opposite of {@link materialize}.</span>
|
||||
*
|
||||
* <img src="./img/dematerialize.png" width="100%">
|
||||
*
|
||||
* `dematerialize` is assumed to operate an Observable that only emits
|
||||
* {@link Notification} objects as `next` emissions, and does not emit any
|
||||
* `error`. Such Observable is the output of a `materialize` operation. Those
|
||||
* notifications are then unwrapped using the metadata they contain, and emitted
|
||||
* as `next`, `error`, and `complete` on the output Observable.
|
||||
*
|
||||
* Use this operator in conjunction with {@link materialize}.
|
||||
*
|
||||
* @example <caption>Convert an Observable of Notifications to an actual Observable</caption>
|
||||
* var notifA = new Rx.Notification('N', 'A');
|
||||
* var notifB = new Rx.Notification('N', 'B');
|
||||
* var notifE = new Rx.Notification('E', void 0,
|
||||
* new TypeError('x.toUpperCase is not a function')
|
||||
* );
|
||||
* var materialized = Rx.Observable.of(notifA, notifB, notifE);
|
||||
* var upperCase = materialized.dematerialize();
|
||||
* upperCase.subscribe(x => console.log(x), e => console.error(e));
|
||||
*
|
||||
* // Results in:
|
||||
* // A
|
||||
* // B
|
||||
* // TypeError: x.toUpperCase is not a function
|
||||
*
|
||||
* @see {@link Notification}
|
||||
* @see {@link materialize}
|
||||
*
|
||||
* @return {Observable} An Observable that emits items and notifications
|
||||
* embedded in Notification objects emitted by the source Observable.
|
||||
* @method dematerialize
|
||||
* @owner Observable
|
||||
*/
|
||||
function dematerialize() {
|
||||
return function dematerializeOperatorFunction(source) {
|
||||
return source.lift(new DeMaterializeOperator());
|
||||
};
|
||||
}
|
||||
exports.dematerialize = dematerialize;
|
||||
var DeMaterializeOperator = (function () {
|
||||
function DeMaterializeOperator() {
|
||||
}
|
||||
DeMaterializeOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new DeMaterializeSubscriber(subscriber));
|
||||
};
|
||||
return DeMaterializeOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var DeMaterializeSubscriber = (function (_super) {
|
||||
__extends(DeMaterializeSubscriber, _super);
|
||||
function DeMaterializeSubscriber(destination) {
|
||||
_super.call(this, destination);
|
||||
}
|
||||
DeMaterializeSubscriber.prototype._next = function (value) {
|
||||
value.observe(this.destination);
|
||||
};
|
||||
return DeMaterializeSubscriber;
|
||||
}(Subscriber_1.Subscriber));
|
||||
//# sourceMappingURL=dematerialize.js.map
|
1
node_modules/rxjs/operators/dematerialize.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/dematerialize.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"dematerialize.js","sourceRoot":"","sources":["../../src/operators/dematerialize.ts"],"names":[],"mappings":";;;;;;AAEA,2BAA2B,eAAe,CAAC,CAAA;AAI3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH;IACE,MAAM,CAAC,uCAAuC,MAAmC;QAC/E,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,qBAAqB,EAAE,CAAC,CAAC;IAClD,CAAC,CAAC;AACJ,CAAC;AAJe,qBAAa,gBAI5B,CAAA;AAED;IAAA;IAIA,CAAC;IAHC,oCAAI,GAAJ,UAAK,UAA2B,EAAE,MAAW;QAC3C,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,uBAAuB,CAAC,UAAU,CAAC,CAAC,CAAC;IACnE,CAAC;IACH,4BAAC;AAAD,CAAC,AAJD,IAIC;AAED;;;;GAIG;AACH;IAAmE,2CAAa;IAC9E,iCAAY,WAA4B;QACtC,kBAAM,WAAW,CAAC,CAAC;IACrB,CAAC;IAES,uCAAK,GAAf,UAAgB,KAAQ;QACtB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC;IACH,8BAAC;AAAD,CAAC,AARD,CAAmE,uBAAU,GAQ5E","sourcesContent":["import { Operator } from '../Operator';\nimport { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { Notification } from '../Notification';\nimport { OperatorFunction } from '../interfaces';\n\n/**\n * Converts an Observable of {@link Notification} objects into the emissions\n * that they represent.\n *\n * <span class=\"informal\">Unwraps {@link Notification} objects as actual `next`,\n * `error` and `complete` emissions. The opposite of {@link materialize}.</span>\n *\n * <img src=\"./img/dematerialize.png\" width=\"100%\">\n *\n * `dematerialize` is assumed to operate an Observable that only emits\n * {@link Notification} objects as `next` emissions, and does not emit any\n * `error`. Such Observable is the output of a `materialize` operation. Those\n * notifications are then unwrapped using the metadata they contain, and emitted\n * as `next`, `error`, and `complete` on the output Observable.\n *\n * Use this operator in conjunction with {@link materialize}.\n *\n * @example <caption>Convert an Observable of Notifications to an actual Observable</caption>\n * var notifA = new Rx.Notification('N', 'A');\n * var notifB = new Rx.Notification('N', 'B');\n * var notifE = new Rx.Notification('E', void 0,\n * new TypeError('x.toUpperCase is not a function')\n * );\n * var materialized = Rx.Observable.of(notifA, notifB, notifE);\n * var upperCase = materialized.dematerialize();\n * upperCase.subscribe(x => console.log(x), e => console.error(e));\n *\n * // Results in:\n * // A\n * // B\n * // TypeError: x.toUpperCase is not a function\n *\n * @see {@link Notification}\n * @see {@link materialize}\n *\n * @return {Observable} An Observable that emits items and notifications\n * embedded in Notification objects emitted by the source Observable.\n * @method dematerialize\n * @owner Observable\n */\nexport function dematerialize<T>(): OperatorFunction<Notification<T>, T> {\n return function dematerializeOperatorFunction(source: Observable<Notification<T>>) {\n return source.lift(new DeMaterializeOperator());\n };\n}\n\nclass DeMaterializeOperator<T extends Notification<any>, R> implements Operator<T, R> {\n call(subscriber: Subscriber<any>, source: any): any {\n return source.subscribe(new DeMaterializeSubscriber(subscriber));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass DeMaterializeSubscriber<T extends Notification<any>> extends Subscriber<T> {\n constructor(destination: Subscriber<any>) {\n super(destination);\n }\n\n protected _next(value: T) {\n value.observe(this.destination);\n }\n}\n"]}
|
66
node_modules/rxjs/operators/distinct.d.ts
generated
vendored
Normal file
66
node_modules/rxjs/operators/distinct.d.ts
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { OuterSubscriber } from '../OuterSubscriber';
|
||||
import { InnerSubscriber } from '../InnerSubscriber';
|
||||
import { MonoTypeOperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items.
|
||||
*
|
||||
* If a keySelector function is provided, then it will project each value from the source observable into a new value that it will
|
||||
* check for equality with previously projected values. If a keySelector function is not provided, it will use each value from the
|
||||
* source observable directly with an equality check against previous values.
|
||||
*
|
||||
* In JavaScript runtimes that support `Set`, this operator will use a `Set` to improve performance of the distinct value checking.
|
||||
*
|
||||
* In other runtimes, this operator will use a minimal implementation of `Set` that relies on an `Array` and `indexOf` under the
|
||||
* hood, so performance will degrade as more values are checked for distinction. Even in newer browsers, a long-running `distinct`
|
||||
* use might result in memory leaks. To help alleviate this in some scenarios, an optional `flushes` parameter is also provided so
|
||||
* that the internal `Set` can be "flushed", basically clearing it of values.
|
||||
*
|
||||
* @example <caption>A simple example with numbers</caption>
|
||||
* Observable.of(1, 1, 2, 2, 2, 1, 2, 3, 4, 3, 2, 1)
|
||||
* .distinct()
|
||||
* .subscribe(x => console.log(x)); // 1, 2, 3, 4
|
||||
*
|
||||
* @example <caption>An example using a keySelector function</caption>
|
||||
* interface Person {
|
||||
* age: number,
|
||||
* name: string
|
||||
* }
|
||||
*
|
||||
* Observable.of<Person>(
|
||||
* { age: 4, name: 'Foo'},
|
||||
* { age: 7, name: 'Bar'},
|
||||
* { age: 5, name: 'Foo'})
|
||||
* .distinct((p: Person) => p.name)
|
||||
* .subscribe(x => console.log(x));
|
||||
*
|
||||
* // displays:
|
||||
* // { age: 4, name: 'Foo' }
|
||||
* // { age: 7, name: 'Bar' }
|
||||
*
|
||||
* @see {@link distinctUntilChanged}
|
||||
* @see {@link distinctUntilKeyChanged}
|
||||
*
|
||||
* @param {function} [keySelector] Optional function to select which value you want to check as distinct.
|
||||
* @param {Observable} [flushes] Optional Observable for flushing the internal HashSet of the operator.
|
||||
* @return {Observable} An Observable that emits items from the source Observable with distinct values.
|
||||
* @method distinct
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function distinct<T, K>(keySelector?: (value: T) => K, flushes?: Observable<any>): MonoTypeOperatorFunction<T>;
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
export declare class DistinctSubscriber<T, K> extends OuterSubscriber<T, T> {
|
||||
private keySelector;
|
||||
private values;
|
||||
constructor(destination: Subscriber<T>, keySelector: (value: T) => K, flushes: Observable<any>);
|
||||
notifyNext(outerValue: T, innerValue: T, outerIndex: number, innerIndex: number, innerSub: InnerSubscriber<T, T>): void;
|
||||
notifyError(error: any, innerSub: InnerSubscriber<T, T>): void;
|
||||
protected _next(value: T): void;
|
||||
private _useKeySelector(value);
|
||||
private _finalizeNext(key, value);
|
||||
}
|
120
node_modules/rxjs/operators/distinct.js
generated
vendored
Normal file
120
node_modules/rxjs/operators/distinct.js
generated
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||||
var Set_1 = require('../util/Set');
|
||||
/**
|
||||
* Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items.
|
||||
*
|
||||
* If a keySelector function is provided, then it will project each value from the source observable into a new value that it will
|
||||
* check for equality with previously projected values. If a keySelector function is not provided, it will use each value from the
|
||||
* source observable directly with an equality check against previous values.
|
||||
*
|
||||
* In JavaScript runtimes that support `Set`, this operator will use a `Set` to improve performance of the distinct value checking.
|
||||
*
|
||||
* In other runtimes, this operator will use a minimal implementation of `Set` that relies on an `Array` and `indexOf` under the
|
||||
* hood, so performance will degrade as more values are checked for distinction. Even in newer browsers, a long-running `distinct`
|
||||
* use might result in memory leaks. To help alleviate this in some scenarios, an optional `flushes` parameter is also provided so
|
||||
* that the internal `Set` can be "flushed", basically clearing it of values.
|
||||
*
|
||||
* @example <caption>A simple example with numbers</caption>
|
||||
* Observable.of(1, 1, 2, 2, 2, 1, 2, 3, 4, 3, 2, 1)
|
||||
* .distinct()
|
||||
* .subscribe(x => console.log(x)); // 1, 2, 3, 4
|
||||
*
|
||||
* @example <caption>An example using a keySelector function</caption>
|
||||
* interface Person {
|
||||
* age: number,
|
||||
* name: string
|
||||
* }
|
||||
*
|
||||
* Observable.of<Person>(
|
||||
* { age: 4, name: 'Foo'},
|
||||
* { age: 7, name: 'Bar'},
|
||||
* { age: 5, name: 'Foo'})
|
||||
* .distinct((p: Person) => p.name)
|
||||
* .subscribe(x => console.log(x));
|
||||
*
|
||||
* // displays:
|
||||
* // { age: 4, name: 'Foo' }
|
||||
* // { age: 7, name: 'Bar' }
|
||||
*
|
||||
* @see {@link distinctUntilChanged}
|
||||
* @see {@link distinctUntilKeyChanged}
|
||||
*
|
||||
* @param {function} [keySelector] Optional function to select which value you want to check as distinct.
|
||||
* @param {Observable} [flushes] Optional Observable for flushing the internal HashSet of the operator.
|
||||
* @return {Observable} An Observable that emits items from the source Observable with distinct values.
|
||||
* @method distinct
|
||||
* @owner Observable
|
||||
*/
|
||||
function distinct(keySelector, flushes) {
|
||||
return function (source) { return source.lift(new DistinctOperator(keySelector, flushes)); };
|
||||
}
|
||||
exports.distinct = distinct;
|
||||
var DistinctOperator = (function () {
|
||||
function DistinctOperator(keySelector, flushes) {
|
||||
this.keySelector = keySelector;
|
||||
this.flushes = flushes;
|
||||
}
|
||||
DistinctOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new DistinctSubscriber(subscriber, this.keySelector, this.flushes));
|
||||
};
|
||||
return DistinctOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var DistinctSubscriber = (function (_super) {
|
||||
__extends(DistinctSubscriber, _super);
|
||||
function DistinctSubscriber(destination, keySelector, flushes) {
|
||||
_super.call(this, destination);
|
||||
this.keySelector = keySelector;
|
||||
this.values = new Set_1.Set();
|
||||
if (flushes) {
|
||||
this.add(subscribeToResult_1.subscribeToResult(this, flushes));
|
||||
}
|
||||
}
|
||||
DistinctSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
|
||||
this.values.clear();
|
||||
};
|
||||
DistinctSubscriber.prototype.notifyError = function (error, innerSub) {
|
||||
this._error(error);
|
||||
};
|
||||
DistinctSubscriber.prototype._next = function (value) {
|
||||
if (this.keySelector) {
|
||||
this._useKeySelector(value);
|
||||
}
|
||||
else {
|
||||
this._finalizeNext(value, value);
|
||||
}
|
||||
};
|
||||
DistinctSubscriber.prototype._useKeySelector = function (value) {
|
||||
var key;
|
||||
var destination = this.destination;
|
||||
try {
|
||||
key = this.keySelector(value);
|
||||
}
|
||||
catch (err) {
|
||||
destination.error(err);
|
||||
return;
|
||||
}
|
||||
this._finalizeNext(key, value);
|
||||
};
|
||||
DistinctSubscriber.prototype._finalizeNext = function (key, value) {
|
||||
var values = this.values;
|
||||
if (!values.has(key)) {
|
||||
values.add(key);
|
||||
this.destination.next(value);
|
||||
}
|
||||
};
|
||||
return DistinctSubscriber;
|
||||
}(OuterSubscriber_1.OuterSubscriber));
|
||||
exports.DistinctSubscriber = DistinctSubscriber;
|
||||
//# sourceMappingURL=distinct.js.map
|
1
node_modules/rxjs/operators/distinct.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/distinct.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/rxjs/operators/distinctUntilChanged.d.ts
generated
vendored
Normal file
3
node_modules/rxjs/operators/distinctUntilChanged.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { MonoTypeOperatorFunction } from '../interfaces';
|
||||
export declare function distinctUntilChanged<T>(compare?: (x: T, y: T) => boolean): MonoTypeOperatorFunction<T>;
|
||||
export declare function distinctUntilChanged<T, K>(compare: (x: K, y: K) => boolean, keySelector: (x: T) => K): MonoTypeOperatorFunction<T>;
|
108
node_modules/rxjs/operators/distinctUntilChanged.js
generated
vendored
Normal file
108
node_modules/rxjs/operators/distinctUntilChanged.js
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Subscriber_1 = require('../Subscriber');
|
||||
var tryCatch_1 = require('../util/tryCatch');
|
||||
var errorObject_1 = require('../util/errorObject');
|
||||
/* tslint:enable:max-line-length */
|
||||
/**
|
||||
* Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from the previous item.
|
||||
*
|
||||
* If a comparator function is provided, then it will be called for each item to test for whether or not that value should be emitted.
|
||||
*
|
||||
* If a comparator function is not provided, an equality check is used by default.
|
||||
*
|
||||
* @example <caption>A simple example with numbers</caption>
|
||||
* Observable.of(1, 1, 2, 2, 2, 1, 1, 2, 3, 3, 4)
|
||||
* .distinctUntilChanged()
|
||||
* .subscribe(x => console.log(x)); // 1, 2, 1, 2, 3, 4
|
||||
*
|
||||
* @example <caption>An example using a compare function</caption>
|
||||
* interface Person {
|
||||
* age: number,
|
||||
* name: string
|
||||
* }
|
||||
*
|
||||
* Observable.of<Person>(
|
||||
* { age: 4, name: 'Foo'},
|
||||
* { age: 7, name: 'Bar'},
|
||||
* { age: 5, name: 'Foo'})
|
||||
* { age: 6, name: 'Foo'})
|
||||
* .distinctUntilChanged((p: Person, q: Person) => p.name === q.name)
|
||||
* .subscribe(x => console.log(x));
|
||||
*
|
||||
* // displays:
|
||||
* // { age: 4, name: 'Foo' }
|
||||
* // { age: 7, name: 'Bar' }
|
||||
* // { age: 5, name: 'Foo' }
|
||||
*
|
||||
* @see {@link distinct}
|
||||
* @see {@link distinctUntilKeyChanged}
|
||||
*
|
||||
* @param {function} [compare] Optional comparison function called to test if an item is distinct from the previous item in the source.
|
||||
* @return {Observable} An Observable that emits items from the source Observable with distinct values.
|
||||
* @method distinctUntilChanged
|
||||
* @owner Observable
|
||||
*/
|
||||
function distinctUntilChanged(compare, keySelector) {
|
||||
return function (source) { return source.lift(new DistinctUntilChangedOperator(compare, keySelector)); };
|
||||
}
|
||||
exports.distinctUntilChanged = distinctUntilChanged;
|
||||
var DistinctUntilChangedOperator = (function () {
|
||||
function DistinctUntilChangedOperator(compare, keySelector) {
|
||||
this.compare = compare;
|
||||
this.keySelector = keySelector;
|
||||
}
|
||||
DistinctUntilChangedOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new DistinctUntilChangedSubscriber(subscriber, this.compare, this.keySelector));
|
||||
};
|
||||
return DistinctUntilChangedOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var DistinctUntilChangedSubscriber = (function (_super) {
|
||||
__extends(DistinctUntilChangedSubscriber, _super);
|
||||
function DistinctUntilChangedSubscriber(destination, compare, keySelector) {
|
||||
_super.call(this, destination);
|
||||
this.keySelector = keySelector;
|
||||
this.hasKey = false;
|
||||
if (typeof compare === 'function') {
|
||||
this.compare = compare;
|
||||
}
|
||||
}
|
||||
DistinctUntilChangedSubscriber.prototype.compare = function (x, y) {
|
||||
return x === y;
|
||||
};
|
||||
DistinctUntilChangedSubscriber.prototype._next = function (value) {
|
||||
var keySelector = this.keySelector;
|
||||
var key = value;
|
||||
if (keySelector) {
|
||||
key = tryCatch_1.tryCatch(this.keySelector)(value);
|
||||
if (key === errorObject_1.errorObject) {
|
||||
return this.destination.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
}
|
||||
var result = false;
|
||||
if (this.hasKey) {
|
||||
result = tryCatch_1.tryCatch(this.compare)(this.key, key);
|
||||
if (result === errorObject_1.errorObject) {
|
||||
return this.destination.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.hasKey = true;
|
||||
}
|
||||
if (Boolean(result) === false) {
|
||||
this.key = key;
|
||||
this.destination.next(value);
|
||||
}
|
||||
};
|
||||
return DistinctUntilChangedSubscriber;
|
||||
}(Subscriber_1.Subscriber));
|
||||
//# sourceMappingURL=distinctUntilChanged.js.map
|
1
node_modules/rxjs/operators/distinctUntilChanged.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/distinctUntilChanged.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/rxjs/operators/distinctUntilKeyChanged.d.ts
generated
vendored
Normal file
3
node_modules/rxjs/operators/distinctUntilKeyChanged.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { MonoTypeOperatorFunction } from '../interfaces';
|
||||
export declare function distinctUntilKeyChanged<T>(key: string): MonoTypeOperatorFunction<T>;
|
||||
export declare function distinctUntilKeyChanged<T, K>(key: string, compare: (x: K, y: K) => boolean): MonoTypeOperatorFunction<T>;
|
65
node_modules/rxjs/operators/distinctUntilKeyChanged.js
generated
vendored
Normal file
65
node_modules/rxjs/operators/distinctUntilKeyChanged.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
var distinctUntilChanged_1 = require('./distinctUntilChanged');
|
||||
/* tslint:enable:max-line-length */
|
||||
/**
|
||||
* Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from the previous item,
|
||||
* using a property accessed by using the key provided to check if the two items are distinct.
|
||||
*
|
||||
* If a comparator function is provided, then it will be called for each item to test for whether or not that value should be emitted.
|
||||
*
|
||||
* If a comparator function is not provided, an equality check is used by default.
|
||||
*
|
||||
* @example <caption>An example comparing the name of persons</caption>
|
||||
*
|
||||
* interface Person {
|
||||
* age: number,
|
||||
* name: string
|
||||
* }
|
||||
*
|
||||
* Observable.of<Person>(
|
||||
* { age: 4, name: 'Foo'},
|
||||
* { age: 7, name: 'Bar'},
|
||||
* { age: 5, name: 'Foo'},
|
||||
* { age: 6, name: 'Foo'})
|
||||
* .distinctUntilKeyChanged('name')
|
||||
* .subscribe(x => console.log(x));
|
||||
*
|
||||
* // displays:
|
||||
* // { age: 4, name: 'Foo' }
|
||||
* // { age: 7, name: 'Bar' }
|
||||
* // { age: 5, name: 'Foo' }
|
||||
*
|
||||
* @example <caption>An example comparing the first letters of the name</caption>
|
||||
*
|
||||
* interface Person {
|
||||
* age: number,
|
||||
* name: string
|
||||
* }
|
||||
*
|
||||
* Observable.of<Person>(
|
||||
* { age: 4, name: 'Foo1'},
|
||||
* { age: 7, name: 'Bar'},
|
||||
* { age: 5, name: 'Foo2'},
|
||||
* { age: 6, name: 'Foo3'})
|
||||
* .distinctUntilKeyChanged('name', (x: string, y: string) => x.substring(0, 3) === y.substring(0, 3))
|
||||
* .subscribe(x => console.log(x));
|
||||
*
|
||||
* // displays:
|
||||
* // { age: 4, name: 'Foo1' }
|
||||
* // { age: 7, name: 'Bar' }
|
||||
* // { age: 5, name: 'Foo2' }
|
||||
*
|
||||
* @see {@link distinct}
|
||||
* @see {@link distinctUntilChanged}
|
||||
*
|
||||
* @param {string} key String key for object property lookup on each item.
|
||||
* @param {function} [compare] Optional comparison function called to test if an item is distinct from the previous item in the source.
|
||||
* @return {Observable} An Observable that emits items from the source Observable with distinct values based on the key specified.
|
||||
* @method distinctUntilKeyChanged
|
||||
* @owner Observable
|
||||
*/
|
||||
function distinctUntilKeyChanged(key, compare) {
|
||||
return distinctUntilChanged_1.distinctUntilChanged(function (x, y) { return compare ? compare(x[key], y[key]) : x[key] === y[key]; });
|
||||
}
|
||||
exports.distinctUntilKeyChanged = distinctUntilKeyChanged;
|
||||
//# sourceMappingURL=distinctUntilKeyChanged.js.map
|
1
node_modules/rxjs/operators/distinctUntilKeyChanged.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/distinctUntilKeyChanged.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"distinctUntilKeyChanged.js","sourceRoot":"","sources":["../../src/operators/distinctUntilKeyChanged.ts"],"names":[],"mappings":";AAAA,qCAAqC,wBAAwB,CAAC,CAAA;AAM9D,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,iCAA2C,GAAW,EAAE,OAAiC;IACvF,MAAM,CAAC,2CAAoB,CAAC,UAAC,CAAI,EAAE,CAAI,IAAK,OAAA,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAArD,CAAqD,CAAC,CAAC;AACrG,CAAC;AAFe,+BAAuB,0BAEtC,CAAA","sourcesContent":["import { distinctUntilChanged } from './distinctUntilChanged';\nimport { MonoTypeOperatorFunction } from '../interfaces';\n\n/* tslint:disable:max-line-length */\nexport function distinctUntilKeyChanged<T>(key: string): MonoTypeOperatorFunction<T>;\nexport function distinctUntilKeyChanged<T, K>(key: string, compare: (x: K, y: K) => boolean): MonoTypeOperatorFunction<T>;\n/* tslint:enable:max-line-length */\n\n/**\n * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from the previous item,\n * using a property accessed by using the key provided to check if the two items are distinct.\n *\n * If a comparator function is provided, then it will be called for each item to test for whether or not that value should be emitted.\n *\n * If a comparator function is not provided, an equality check is used by default.\n *\n * @example <caption>An example comparing the name of persons</caption>\n *\n * interface Person {\n * age: number,\n * name: string\n * }\n *\n * Observable.of<Person>(\n * { age: 4, name: 'Foo'},\n * { age: 7, name: 'Bar'},\n * { age: 5, name: 'Foo'},\n * { age: 6, name: 'Foo'})\n * .distinctUntilKeyChanged('name')\n * .subscribe(x => console.log(x));\n *\n * // displays:\n * // { age: 4, name: 'Foo' }\n * // { age: 7, name: 'Bar' }\n * // { age: 5, name: 'Foo' }\n *\n * @example <caption>An example comparing the first letters of the name</caption>\n *\n * interface Person {\n * age: number,\n * name: string\n * }\n *\n * Observable.of<Person>(\n * { age: 4, name: 'Foo1'},\n * { age: 7, name: 'Bar'},\n * { age: 5, name: 'Foo2'},\n * { age: 6, name: 'Foo3'})\n * .distinctUntilKeyChanged('name', (x: string, y: string) => x.substring(0, 3) === y.substring(0, 3))\n * .subscribe(x => console.log(x));\n *\n * // displays:\n * // { age: 4, name: 'Foo1' }\n * // { age: 7, name: 'Bar' }\n * // { age: 5, name: 'Foo2' }\n *\n * @see {@link distinct}\n * @see {@link distinctUntilChanged}\n *\n * @param {string} key String key for object property lookup on each item.\n * @param {function} [compare] Optional comparison function called to test if an item is distinct from the previous item in the source.\n * @return {Observable} An Observable that emits items from the source Observable with distinct values based on the key specified.\n * @method distinctUntilKeyChanged\n * @owner Observable\n */\nexport function distinctUntilKeyChanged<T>(key: string, compare?: (x: T, y: T) => boolean): MonoTypeOperatorFunction<T> {\n return distinctUntilChanged((x: T, y: T) => compare ? compare(x[key], y[key]) : x[key] === y[key]);\n}\n"]}
|
44
node_modules/rxjs/operators/elementAt.d.ts
generated
vendored
Normal file
44
node_modules/rxjs/operators/elementAt.d.ts
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import { MonoTypeOperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* Emits the single value at the specified `index` in a sequence of emissions
|
||||
* from the source Observable.
|
||||
*
|
||||
* <span class="informal">Emits only the i-th value, then completes.</span>
|
||||
*
|
||||
* <img src="./img/elementAt.png" width="100%">
|
||||
*
|
||||
* `elementAt` returns an Observable that emits the item at the specified
|
||||
* `index` in the source Observable, or a default value if that `index` is out
|
||||
* of range and the `default` argument is provided. If the `default` argument is
|
||||
* not given and the `index` is out of range, the output Observable will emit an
|
||||
* `ArgumentOutOfRangeError` error.
|
||||
*
|
||||
* @example <caption>Emit only the third click event</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var result = clicks.elementAt(2);
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Results in:
|
||||
* // click 1 = nothing
|
||||
* // click 2 = nothing
|
||||
* // click 3 = MouseEvent object logged to console
|
||||
*
|
||||
* @see {@link first}
|
||||
* @see {@link last}
|
||||
* @see {@link skip}
|
||||
* @see {@link single}
|
||||
* @see {@link take}
|
||||
*
|
||||
* @throws {ArgumentOutOfRangeError} When using `elementAt(i)`, it delivers an
|
||||
* ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0` or the
|
||||
* Observable has completed before emitting the i-th `next` notification.
|
||||
*
|
||||
* @param {number} index Is the number `i` for the i-th source emission that has
|
||||
* happened since the subscription, starting from the number `0`.
|
||||
* @param {T} [defaultValue] The default value returned for missing indices.
|
||||
* @return {Observable} An Observable that emits a single item, if it is found.
|
||||
* Otherwise, will emit the default value if given. If not, then emits an error.
|
||||
* @method elementAt
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function elementAt<T>(index: number, defaultValue?: T): MonoTypeOperatorFunction<T>;
|
100
node_modules/rxjs/operators/elementAt.js
generated
vendored
Normal file
100
node_modules/rxjs/operators/elementAt.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Subscriber_1 = require('../Subscriber');
|
||||
var ArgumentOutOfRangeError_1 = require('../util/ArgumentOutOfRangeError');
|
||||
/**
|
||||
* Emits the single value at the specified `index` in a sequence of emissions
|
||||
* from the source Observable.
|
||||
*
|
||||
* <span class="informal">Emits only the i-th value, then completes.</span>
|
||||
*
|
||||
* <img src="./img/elementAt.png" width="100%">
|
||||
*
|
||||
* `elementAt` returns an Observable that emits the item at the specified
|
||||
* `index` in the source Observable, or a default value if that `index` is out
|
||||
* of range and the `default` argument is provided. If the `default` argument is
|
||||
* not given and the `index` is out of range, the output Observable will emit an
|
||||
* `ArgumentOutOfRangeError` error.
|
||||
*
|
||||
* @example <caption>Emit only the third click event</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var result = clicks.elementAt(2);
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Results in:
|
||||
* // click 1 = nothing
|
||||
* // click 2 = nothing
|
||||
* // click 3 = MouseEvent object logged to console
|
||||
*
|
||||
* @see {@link first}
|
||||
* @see {@link last}
|
||||
* @see {@link skip}
|
||||
* @see {@link single}
|
||||
* @see {@link take}
|
||||
*
|
||||
* @throws {ArgumentOutOfRangeError} When using `elementAt(i)`, it delivers an
|
||||
* ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0` or the
|
||||
* Observable has completed before emitting the i-th `next` notification.
|
||||
*
|
||||
* @param {number} index Is the number `i` for the i-th source emission that has
|
||||
* happened since the subscription, starting from the number `0`.
|
||||
* @param {T} [defaultValue] The default value returned for missing indices.
|
||||
* @return {Observable} An Observable that emits a single item, if it is found.
|
||||
* Otherwise, will emit the default value if given. If not, then emits an error.
|
||||
* @method elementAt
|
||||
* @owner Observable
|
||||
*/
|
||||
function elementAt(index, defaultValue) {
|
||||
return function (source) { return source.lift(new ElementAtOperator(index, defaultValue)); };
|
||||
}
|
||||
exports.elementAt = elementAt;
|
||||
var ElementAtOperator = (function () {
|
||||
function ElementAtOperator(index, defaultValue) {
|
||||
this.index = index;
|
||||
this.defaultValue = defaultValue;
|
||||
if (index < 0) {
|
||||
throw new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError;
|
||||
}
|
||||
}
|
||||
ElementAtOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new ElementAtSubscriber(subscriber, this.index, this.defaultValue));
|
||||
};
|
||||
return ElementAtOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var ElementAtSubscriber = (function (_super) {
|
||||
__extends(ElementAtSubscriber, _super);
|
||||
function ElementAtSubscriber(destination, index, defaultValue) {
|
||||
_super.call(this, destination);
|
||||
this.index = index;
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
ElementAtSubscriber.prototype._next = function (x) {
|
||||
if (this.index-- === 0) {
|
||||
this.destination.next(x);
|
||||
this.destination.complete();
|
||||
}
|
||||
};
|
||||
ElementAtSubscriber.prototype._complete = function () {
|
||||
var destination = this.destination;
|
||||
if (this.index >= 0) {
|
||||
if (typeof this.defaultValue !== 'undefined') {
|
||||
destination.next(this.defaultValue);
|
||||
}
|
||||
else {
|
||||
destination.error(new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError);
|
||||
}
|
||||
}
|
||||
destination.complete();
|
||||
};
|
||||
return ElementAtSubscriber;
|
||||
}(Subscriber_1.Subscriber));
|
||||
//# sourceMappingURL=elementAt.js.map
|
1
node_modules/rxjs/operators/elementAt.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/elementAt.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"elementAt.js","sourceRoot":"","sources":["../../src/operators/elementAt.ts"],"names":[],"mappings":";;;;;;AACA,2BAA2B,eAAe,CAAC,CAAA;AAC3C,wCAAwC,iCAAiC,CAAC,CAAA;AAK1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,mBAA6B,KAAa,EAAE,YAAgB;IAC1D,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,EAAvD,CAAuD,CAAC;AAC5F,CAAC;AAFe,iBAAS,YAExB,CAAA;AAED;IAEE,2BAAoB,KAAa,EAAU,YAAgB;QAAvC,UAAK,GAAL,KAAK,CAAQ;QAAU,iBAAY,GAAZ,YAAY,CAAI;QACzD,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;YACd,MAAM,IAAI,iDAAuB,CAAC;QACpC,CAAC;IACH,CAAC;IAED,gCAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,mBAAmB,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAC9F,CAAC;IACH,wBAAC;AAAD,CAAC,AAXD,IAWC;AAED;;;;GAIG;AACH;IAAqC,uCAAa;IAEhD,6BAAY,WAA0B,EAAU,KAAa,EAAU,YAAgB;QACrF,kBAAM,WAAW,CAAC,CAAC;QAD2B,UAAK,GAAL,KAAK,CAAQ;QAAU,iBAAY,GAAZ,YAAY,CAAI;IAEvF,CAAC;IAES,mCAAK,GAAf,UAAgB,CAAI;QAClB,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;YACvB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACzB,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC;IAES,uCAAS,GAAnB;QACE,IAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACrC,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,EAAE,CAAC,CAAC,OAAO,IAAI,CAAC,YAAY,KAAK,WAAW,CAAC,CAAC,CAAC;gBAC7C,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACtC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACN,WAAW,CAAC,KAAK,CAAC,IAAI,iDAAuB,CAAC,CAAC;YACjD,CAAC;QACH,CAAC;QACD,WAAW,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IACH,0BAAC;AAAD,CAAC,AAxBD,CAAqC,uBAAU,GAwB9C","sourcesContent":["import { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { ArgumentOutOfRangeError } from '../util/ArgumentOutOfRangeError';\nimport { Observable } from '../Observable';\nimport { TeardownLogic } from '../Subscription';\nimport { MonoTypeOperatorFunction } from '../interfaces';\n\n/**\n * Emits the single value at the specified `index` in a sequence of emissions\n * from the source Observable.\n *\n * <span class=\"informal\">Emits only the i-th value, then completes.</span>\n *\n * <img src=\"./img/elementAt.png\" width=\"100%\">\n *\n * `elementAt` returns an Observable that emits the item at the specified\n * `index` in the source Observable, or a default value if that `index` is out\n * of range and the `default` argument is provided. If the `default` argument is\n * not given and the `index` is out of range, the output Observable will emit an\n * `ArgumentOutOfRangeError` error.\n *\n * @example <caption>Emit only the third click event</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.elementAt(2);\n * result.subscribe(x => console.log(x));\n *\n * // Results in:\n * // click 1 = nothing\n * // click 2 = nothing\n * // click 3 = MouseEvent object logged to console\n *\n * @see {@link first}\n * @see {@link last}\n * @see {@link skip}\n * @see {@link single}\n * @see {@link take}\n *\n * @throws {ArgumentOutOfRangeError} When using `elementAt(i)`, it delivers an\n * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0` or the\n * Observable has completed before emitting the i-th `next` notification.\n *\n * @param {number} index Is the number `i` for the i-th source emission that has\n * happened since the subscription, starting from the number `0`.\n * @param {T} [defaultValue] The default value returned for missing indices.\n * @return {Observable} An Observable that emits a single item, if it is found.\n * Otherwise, will emit the default value if given. If not, then emits an error.\n * @method elementAt\n * @owner Observable\n */\nexport function elementAt<T>(index: number, defaultValue?: T): MonoTypeOperatorFunction<T> {\n return (source: Observable<T>) => source.lift(new ElementAtOperator(index, defaultValue));\n}\n\nclass ElementAtOperator<T> implements Operator<T, T> {\n\n constructor(private index: number, private defaultValue?: T) {\n if (index < 0) {\n throw new ArgumentOutOfRangeError;\n }\n }\n\n call(subscriber: Subscriber<T>, source: any): TeardownLogic {\n return source.subscribe(new ElementAtSubscriber(subscriber, this.index, this.defaultValue));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass ElementAtSubscriber<T> extends Subscriber<T> {\n\n constructor(destination: Subscriber<T>, private index: number, private defaultValue?: T) {\n super(destination);\n }\n\n protected _next(x: T) {\n if (this.index-- === 0) {\n this.destination.next(x);\n this.destination.complete();\n }\n }\n\n protected _complete() {\n const destination = this.destination;\n if (this.index >= 0) {\n if (typeof this.defaultValue !== 'undefined') {\n destination.next(this.defaultValue);\n } else {\n destination.error(new ArgumentOutOfRangeError);\n }\n }\n destination.complete();\n }\n}\n"]}
|
17
node_modules/rxjs/operators/every.d.ts
generated
vendored
Normal file
17
node_modules/rxjs/operators/every.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { OperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* Returns an Observable that emits whether or not every item of the source satisfies the condition specified.
|
||||
*
|
||||
* @example <caption>A simple example emitting true if all elements are less than 5, false otherwise</caption>
|
||||
* Observable.of(1, 2, 3, 4, 5, 6)
|
||||
* .every(x => x < 5)
|
||||
* .subscribe(x => console.log(x)); // -> false
|
||||
*
|
||||
* @param {function} predicate A function for determining if an item meets a specified condition.
|
||||
* @param {any} [thisArg] Optional object to use for `this` in the callback.
|
||||
* @return {Observable} An Observable of booleans that determines if all items of the source Observable meet the condition specified.
|
||||
* @method every
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function every<T>(predicate: (value: T, index: number, source: Observable<T>) => boolean, thisArg?: any): OperatorFunction<T, boolean>;
|
74
node_modules/rxjs/operators/every.js
generated
vendored
Normal file
74
node_modules/rxjs/operators/every.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Subscriber_1 = require('../Subscriber');
|
||||
/**
|
||||
* Returns an Observable that emits whether or not every item of the source satisfies the condition specified.
|
||||
*
|
||||
* @example <caption>A simple example emitting true if all elements are less than 5, false otherwise</caption>
|
||||
* Observable.of(1, 2, 3, 4, 5, 6)
|
||||
* .every(x => x < 5)
|
||||
* .subscribe(x => console.log(x)); // -> false
|
||||
*
|
||||
* @param {function} predicate A function for determining if an item meets a specified condition.
|
||||
* @param {any} [thisArg] Optional object to use for `this` in the callback.
|
||||
* @return {Observable} An Observable of booleans that determines if all items of the source Observable meet the condition specified.
|
||||
* @method every
|
||||
* @owner Observable
|
||||
*/
|
||||
function every(predicate, thisArg) {
|
||||
return function (source) { return source.lift(new EveryOperator(predicate, thisArg, source)); };
|
||||
}
|
||||
exports.every = every;
|
||||
var EveryOperator = (function () {
|
||||
function EveryOperator(predicate, thisArg, source) {
|
||||
this.predicate = predicate;
|
||||
this.thisArg = thisArg;
|
||||
this.source = source;
|
||||
}
|
||||
EveryOperator.prototype.call = function (observer, source) {
|
||||
return source.subscribe(new EverySubscriber(observer, this.predicate, this.thisArg, this.source));
|
||||
};
|
||||
return EveryOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var EverySubscriber = (function (_super) {
|
||||
__extends(EverySubscriber, _super);
|
||||
function EverySubscriber(destination, predicate, thisArg, source) {
|
||||
_super.call(this, destination);
|
||||
this.predicate = predicate;
|
||||
this.thisArg = thisArg;
|
||||
this.source = source;
|
||||
this.index = 0;
|
||||
this.thisArg = thisArg || this;
|
||||
}
|
||||
EverySubscriber.prototype.notifyComplete = function (everyValueMatch) {
|
||||
this.destination.next(everyValueMatch);
|
||||
this.destination.complete();
|
||||
};
|
||||
EverySubscriber.prototype._next = function (value) {
|
||||
var result = false;
|
||||
try {
|
||||
result = this.predicate.call(this.thisArg, value, this.index++, this.source);
|
||||
}
|
||||
catch (err) {
|
||||
this.destination.error(err);
|
||||
return;
|
||||
}
|
||||
if (!result) {
|
||||
this.notifyComplete(false);
|
||||
}
|
||||
};
|
||||
EverySubscriber.prototype._complete = function () {
|
||||
this.notifyComplete(true);
|
||||
};
|
||||
return EverySubscriber;
|
||||
}(Subscriber_1.Subscriber));
|
||||
//# sourceMappingURL=every.js.map
|
1
node_modules/rxjs/operators/every.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/every.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"every.js","sourceRoot":"","sources":["../../src/operators/every.ts"],"names":[],"mappings":";;;;;;AAGA,2BAA2B,eAAe,CAAC,CAAA;AAG3C;;;;;;;;;;;;;GAaG;AACH,eAAyB,SAAsE,EACtE,OAAa;IACpC,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,EAA1D,CAA0D,CAAC;AAC/F,CAAC;AAHe,aAAK,QAGpB,CAAA;AAED;IACE,uBAAoB,SAAsE,EACtE,OAAa,EACb,MAAsB;QAFtB,cAAS,GAAT,SAAS,CAA6D;QACtE,YAAO,GAAP,OAAO,CAAM;QACb,WAAM,GAAN,MAAM,CAAgB;IAC1C,CAAC;IAED,4BAAI,GAAJ,UAAK,QAA6B,EAAE,MAAW;QAC7C,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IACpG,CAAC;IACH,oBAAC;AAAD,CAAC,AATD,IASC;AAED;;;;GAIG;AACH;IAAiC,mCAAa;IAG5C,yBAAY,WAA8B,EACtB,SAAsE,EACtE,OAAY,EACZ,MAAsB;QACxC,kBAAM,WAAW,CAAC,CAAC;QAHD,cAAS,GAAT,SAAS,CAA6D;QACtE,YAAO,GAAP,OAAO,CAAK;QACZ,WAAM,GAAN,MAAM,CAAgB;QALlC,UAAK,GAAW,CAAC,CAAC;QAOxB,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,IAAI,CAAC;IACjC,CAAC;IAEO,wCAAc,GAAtB,UAAuB,eAAwB;QAC7C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACvC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;IAC9B,CAAC;IAES,+BAAK,GAAf,UAAgB,KAAQ;QACtB,IAAI,MAAM,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC;YACH,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/E,CAAE;QAAA,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACb,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5B,MAAM,CAAC;QACT,CAAC;QAED,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACZ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAES,mCAAS,GAAnB;QACE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IACH,sBAAC;AAAD,CAAC,AAjCD,CAAiC,uBAAU,GAiC1C","sourcesContent":["import { Operator } from '../Operator';\nimport { Observer } from '../Observer';\nimport { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { OperatorFunction } from '../interfaces';\n\n/**\n * Returns an Observable that emits whether or not every item of the source satisfies the condition specified.\n *\n * @example <caption>A simple example emitting true if all elements are less than 5, false otherwise</caption>\n * Observable.of(1, 2, 3, 4, 5, 6)\n * .every(x => x < 5)\n * .subscribe(x => console.log(x)); // -> false\n *\n * @param {function} predicate A function for determining if an item meets a specified condition.\n * @param {any} [thisArg] Optional object to use for `this` in the callback.\n * @return {Observable} An Observable of booleans that determines if all items of the source Observable meet the condition specified.\n * @method every\n * @owner Observable\n */\nexport function every<T>(predicate: (value: T, index: number, source: Observable<T>) => boolean,\n thisArg?: any): OperatorFunction<T, boolean> {\n return (source: Observable<T>) => source.lift(new EveryOperator(predicate, thisArg, source));\n}\n\nclass EveryOperator<T> implements Operator<T, boolean> {\n constructor(private predicate: (value: T, index: number, source: Observable<T>) => boolean,\n private thisArg?: any,\n private source?: Observable<T>) {\n }\n\n call(observer: Subscriber<boolean>, source: any): any {\n return source.subscribe(new EverySubscriber(observer, this.predicate, this.thisArg, this.source));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass EverySubscriber<T> extends Subscriber<T> {\n private index: number = 0;\n\n constructor(destination: Observer<boolean>,\n private predicate: (value: T, index: number, source: Observable<T>) => boolean,\n private thisArg: any,\n private source?: Observable<T>) {\n super(destination);\n this.thisArg = thisArg || this;\n }\n\n private notifyComplete(everyValueMatch: boolean): void {\n this.destination.next(everyValueMatch);\n this.destination.complete();\n }\n\n protected _next(value: T): void {\n let result = false;\n try {\n result = this.predicate.call(this.thisArg, value, this.index++, this.source);\n } catch (err) {\n this.destination.error(err);\n return;\n }\n\n if (!result) {\n this.notifyComplete(false);\n }\n }\n\n protected _complete(): void {\n this.notifyComplete(true);\n }\n}\n"]}
|
37
node_modules/rxjs/operators/exhaust.d.ts
generated
vendored
Normal file
37
node_modules/rxjs/operators/exhaust.d.ts
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import { MonoTypeOperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* Converts a higher-order Observable into a first-order Observable by dropping
|
||||
* inner Observables while the previous inner Observable has not yet completed.
|
||||
*
|
||||
* <span class="informal">Flattens an Observable-of-Observables by dropping the
|
||||
* next inner Observables while the current inner is still executing.</span>
|
||||
*
|
||||
* <img src="./img/exhaust.png" width="100%">
|
||||
*
|
||||
* `exhaust` subscribes to an Observable that emits Observables, also known as a
|
||||
* higher-order Observable. Each time it observes one of these emitted inner
|
||||
* Observables, the output Observable begins emitting the items emitted by that
|
||||
* inner Observable. So far, it behaves like {@link mergeAll}. However,
|
||||
* `exhaust` ignores every new inner Observable if the previous Observable has
|
||||
* not yet completed. Once that one completes, it will accept and flatten the
|
||||
* next inner Observable and repeat this process.
|
||||
*
|
||||
* @example <caption>Run a finite timer for each click, only if there is no currently active timer</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(5));
|
||||
* var result = higherOrder.exhaust();
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link combineAll}
|
||||
* @see {@link concatAll}
|
||||
* @see {@link switch}
|
||||
* @see {@link mergeAll}
|
||||
* @see {@link exhaustMap}
|
||||
* @see {@link zipAll}
|
||||
*
|
||||
* @return {Observable} An Observable that takes a source of Observables and propagates the first observable
|
||||
* exclusively until it completes before subscribing to the next.
|
||||
* @method exhaust
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function exhaust<T>(): MonoTypeOperatorFunction<T>;
|
89
node_modules/rxjs/operators/exhaust.js
generated
vendored
Normal file
89
node_modules/rxjs/operators/exhaust.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||||
/**
|
||||
* Converts a higher-order Observable into a first-order Observable by dropping
|
||||
* inner Observables while the previous inner Observable has not yet completed.
|
||||
*
|
||||
* <span class="informal">Flattens an Observable-of-Observables by dropping the
|
||||
* next inner Observables while the current inner is still executing.</span>
|
||||
*
|
||||
* <img src="./img/exhaust.png" width="100%">
|
||||
*
|
||||
* `exhaust` subscribes to an Observable that emits Observables, also known as a
|
||||
* higher-order Observable. Each time it observes one of these emitted inner
|
||||
* Observables, the output Observable begins emitting the items emitted by that
|
||||
* inner Observable. So far, it behaves like {@link mergeAll}. However,
|
||||
* `exhaust` ignores every new inner Observable if the previous Observable has
|
||||
* not yet completed. Once that one completes, it will accept and flatten the
|
||||
* next inner Observable and repeat this process.
|
||||
*
|
||||
* @example <caption>Run a finite timer for each click, only if there is no currently active timer</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(5));
|
||||
* var result = higherOrder.exhaust();
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link combineAll}
|
||||
* @see {@link concatAll}
|
||||
* @see {@link switch}
|
||||
* @see {@link mergeAll}
|
||||
* @see {@link exhaustMap}
|
||||
* @see {@link zipAll}
|
||||
*
|
||||
* @return {Observable} An Observable that takes a source of Observables and propagates the first observable
|
||||
* exclusively until it completes before subscribing to the next.
|
||||
* @method exhaust
|
||||
* @owner Observable
|
||||
*/
|
||||
function exhaust() {
|
||||
return function (source) { return source.lift(new SwitchFirstOperator()); };
|
||||
}
|
||||
exports.exhaust = exhaust;
|
||||
var SwitchFirstOperator = (function () {
|
||||
function SwitchFirstOperator() {
|
||||
}
|
||||
SwitchFirstOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new SwitchFirstSubscriber(subscriber));
|
||||
};
|
||||
return SwitchFirstOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var SwitchFirstSubscriber = (function (_super) {
|
||||
__extends(SwitchFirstSubscriber, _super);
|
||||
function SwitchFirstSubscriber(destination) {
|
||||
_super.call(this, destination);
|
||||
this.hasCompleted = false;
|
||||
this.hasSubscription = false;
|
||||
}
|
||||
SwitchFirstSubscriber.prototype._next = function (value) {
|
||||
if (!this.hasSubscription) {
|
||||
this.hasSubscription = true;
|
||||
this.add(subscribeToResult_1.subscribeToResult(this, value));
|
||||
}
|
||||
};
|
||||
SwitchFirstSubscriber.prototype._complete = function () {
|
||||
this.hasCompleted = true;
|
||||
if (!this.hasSubscription) {
|
||||
this.destination.complete();
|
||||
}
|
||||
};
|
||||
SwitchFirstSubscriber.prototype.notifyComplete = function (innerSub) {
|
||||
this.remove(innerSub);
|
||||
this.hasSubscription = false;
|
||||
if (this.hasCompleted) {
|
||||
this.destination.complete();
|
||||
}
|
||||
};
|
||||
return SwitchFirstSubscriber;
|
||||
}(OuterSubscriber_1.OuterSubscriber));
|
||||
//# sourceMappingURL=exhaust.js.map
|
1
node_modules/rxjs/operators/exhaust.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/exhaust.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"exhaust.js","sourceRoot":"","sources":["../../src/operators/exhaust.ts"],"names":[],"mappings":";;;;;;AAIA,gCAAgC,oBAAoB,CAAC,CAAA;AACrD,kCAAkC,2BAA2B,CAAC,CAAA;AAG9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH;IACE,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,mBAAmB,EAAK,CAAC,EAAzC,CAAyC,CAAC;AAC9E,CAAC;AAFe,eAAO,UAEtB,CAAA;AAED;IAAA;IAIA,CAAC;IAHC,kCAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAC;IACjE,CAAC;IACH,0BAAC;AAAD,CAAC,AAJD,IAIC;AAED;;;;GAIG;AACH;IAAuC,yCAAqB;IAI1D,+BAAY,WAA0B;QACpC,kBAAM,WAAW,CAAC,CAAC;QAJb,iBAAY,GAAY,KAAK,CAAC;QAC9B,oBAAe,GAAY,KAAK,CAAC;IAIzC,CAAC;IAES,qCAAK,GAAf,UAAgB,KAAQ;QACtB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;YAC1B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;YAC5B,IAAI,CAAC,GAAG,CAAC,qCAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAES,yCAAS,GAAnB;QACE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;YAC1B,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC;IAED,8CAAc,GAAd,UAAe,QAAsB;QACnC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACtB,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;YACtB,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC;IACH,4BAAC;AAAD,CAAC,AA7BD,CAAuC,iCAAe,GA6BrD","sourcesContent":["import { Operator } from '../Operator';\nimport { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { Subscription, TeardownLogic } from '../Subscription';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nimport { MonoTypeOperatorFunction } from '../interfaces';\n\n/**\n * Converts a higher-order Observable into a first-order Observable by dropping\n * inner Observables while the previous inner Observable has not yet completed.\n *\n * <span class=\"informal\">Flattens an Observable-of-Observables by dropping the\n * next inner Observables while the current inner is still executing.</span>\n *\n * <img src=\"./img/exhaust.png\" width=\"100%\">\n *\n * `exhaust` subscribes to an Observable that emits Observables, also known as a\n * higher-order Observable. Each time it observes one of these emitted inner\n * Observables, the output Observable begins emitting the items emitted by that\n * inner Observable. So far, it behaves like {@link mergeAll}. However,\n * `exhaust` ignores every new inner Observable if the previous Observable has\n * not yet completed. Once that one completes, it will accept and flatten the\n * next inner Observable and repeat this process.\n *\n * @example <caption>Run a finite timer for each click, only if there is no currently active timer</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(5));\n * var result = higherOrder.exhaust();\n * result.subscribe(x => console.log(x));\n *\n * @see {@link combineAll}\n * @see {@link concatAll}\n * @see {@link switch}\n * @see {@link mergeAll}\n * @see {@link exhaustMap}\n * @see {@link zipAll}\n *\n * @return {Observable} An Observable that takes a source of Observables and propagates the first observable\n * exclusively until it completes before subscribing to the next.\n * @method exhaust\n * @owner Observable\n */\nexport function exhaust<T>(): MonoTypeOperatorFunction<T> {\n return (source: Observable<T>) => source.lift(new SwitchFirstOperator<T>());\n}\n\nclass SwitchFirstOperator<T> implements Operator<T, T> {\n call(subscriber: Subscriber<T>, source: any): TeardownLogic {\n return source.subscribe(new SwitchFirstSubscriber(subscriber));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass SwitchFirstSubscriber<T> extends OuterSubscriber<T, T> {\n private hasCompleted: boolean = false;\n private hasSubscription: boolean = false;\n\n constructor(destination: Subscriber<T>) {\n super(destination);\n }\n\n protected _next(value: T): void {\n if (!this.hasSubscription) {\n this.hasSubscription = true;\n this.add(subscribeToResult(this, value));\n }\n }\n\n protected _complete(): void {\n this.hasCompleted = true;\n if (!this.hasSubscription) {\n this.destination.complete();\n }\n }\n\n notifyComplete(innerSub: Subscription): void {\n this.remove(innerSub);\n this.hasSubscription = false;\n if (this.hasCompleted) {\n this.destination.complete();\n }\n }\n}\n"]}
|
4
node_modules/rxjs/operators/exhaustMap.d.ts
generated
vendored
Normal file
4
node_modules/rxjs/operators/exhaustMap.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import { ObservableInput } from '../Observable';
|
||||
import { OperatorFunction } from '../interfaces';
|
||||
export declare function exhaustMap<T, R>(project: (value: T, index: number) => ObservableInput<R>): OperatorFunction<T, R>;
|
||||
export declare function exhaustMap<T, I, R>(project: (value: T, index: number) => ObservableInput<I>, resultSelector: (outerValue: T, innerValue: I, outerIndex: number, innerIndex: number) => R): OperatorFunction<T, R>;
|
138
node_modules/rxjs/operators/exhaustMap.js
generated
vendored
Normal file
138
node_modules/rxjs/operators/exhaustMap.js
generated
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||||
/* tslint:enable:max-line-length */
|
||||
/**
|
||||
* Projects each source value to an Observable which is merged in the output
|
||||
* Observable only if the previous projected Observable has completed.
|
||||
*
|
||||
* <span class="informal">Maps each value to an Observable, then flattens all of
|
||||
* these inner Observables using {@link exhaust}.</span>
|
||||
*
|
||||
* <img src="./img/exhaustMap.png" width="100%">
|
||||
*
|
||||
* Returns an Observable that emits items based on applying a function that you
|
||||
* supply to each item emitted by the source Observable, where that function
|
||||
* returns an (so-called "inner") Observable. When it projects a source value to
|
||||
* an Observable, the output Observable begins emitting the items emitted by
|
||||
* that projected Observable. However, `exhaustMap` ignores every new projected
|
||||
* Observable if the previous projected Observable has not yet completed. Once
|
||||
* that one completes, it will accept and flatten the next projected Observable
|
||||
* and repeat this process.
|
||||
*
|
||||
* @example <caption>Run a finite timer for each click, only if there is no currently active timer</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var result = clicks.exhaustMap((ev) => Rx.Observable.interval(1000).take(5));
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link concatMap}
|
||||
* @see {@link exhaust}
|
||||
* @see {@link mergeMap}
|
||||
* @see {@link switchMap}
|
||||
*
|
||||
* @param {function(value: T, ?index: number): ObservableInput} project A function
|
||||
* that, when applied to an item emitted by the source Observable, returns an
|
||||
* Observable.
|
||||
* @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector]
|
||||
* A function to produce the value on the output Observable based on the values
|
||||
* and the indices of the source (outer) emission and the inner Observable
|
||||
* emission. The arguments passed to this function are:
|
||||
* - `outerValue`: the value that came from the source
|
||||
* - `innerValue`: the value that came from the projected Observable
|
||||
* - `outerIndex`: the "index" of the value that came from the source
|
||||
* - `innerIndex`: the "index" of the value from the projected Observable
|
||||
* @return {Observable} An Observable containing projected Observables
|
||||
* of each item of the source, ignoring projected Observables that start before
|
||||
* their preceding Observable has completed.
|
||||
* @method exhaustMap
|
||||
* @owner Observable
|
||||
*/
|
||||
function exhaustMap(project, resultSelector) {
|
||||
return function (source) { return source.lift(new SwitchFirstMapOperator(project, resultSelector)); };
|
||||
}
|
||||
exports.exhaustMap = exhaustMap;
|
||||
var SwitchFirstMapOperator = (function () {
|
||||
function SwitchFirstMapOperator(project, resultSelector) {
|
||||
this.project = project;
|
||||
this.resultSelector = resultSelector;
|
||||
}
|
||||
SwitchFirstMapOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new SwitchFirstMapSubscriber(subscriber, this.project, this.resultSelector));
|
||||
};
|
||||
return SwitchFirstMapOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var SwitchFirstMapSubscriber = (function (_super) {
|
||||
__extends(SwitchFirstMapSubscriber, _super);
|
||||
function SwitchFirstMapSubscriber(destination, project, resultSelector) {
|
||||
_super.call(this, destination);
|
||||
this.project = project;
|
||||
this.resultSelector = resultSelector;
|
||||
this.hasSubscription = false;
|
||||
this.hasCompleted = false;
|
||||
this.index = 0;
|
||||
}
|
||||
SwitchFirstMapSubscriber.prototype._next = function (value) {
|
||||
if (!this.hasSubscription) {
|
||||
this.tryNext(value);
|
||||
}
|
||||
};
|
||||
SwitchFirstMapSubscriber.prototype.tryNext = function (value) {
|
||||
var index = this.index++;
|
||||
var destination = this.destination;
|
||||
try {
|
||||
var result = this.project(value, index);
|
||||
this.hasSubscription = true;
|
||||
this.add(subscribeToResult_1.subscribeToResult(this, result, value, index));
|
||||
}
|
||||
catch (err) {
|
||||
destination.error(err);
|
||||
}
|
||||
};
|
||||
SwitchFirstMapSubscriber.prototype._complete = function () {
|
||||
this.hasCompleted = true;
|
||||
if (!this.hasSubscription) {
|
||||
this.destination.complete();
|
||||
}
|
||||
};
|
||||
SwitchFirstMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
|
||||
var _a = this, resultSelector = _a.resultSelector, destination = _a.destination;
|
||||
if (resultSelector) {
|
||||
this.trySelectResult(outerValue, innerValue, outerIndex, innerIndex);
|
||||
}
|
||||
else {
|
||||
destination.next(innerValue);
|
||||
}
|
||||
};
|
||||
SwitchFirstMapSubscriber.prototype.trySelectResult = function (outerValue, innerValue, outerIndex, innerIndex) {
|
||||
var _a = this, resultSelector = _a.resultSelector, destination = _a.destination;
|
||||
try {
|
||||
var result = resultSelector(outerValue, innerValue, outerIndex, innerIndex);
|
||||
destination.next(result);
|
||||
}
|
||||
catch (err) {
|
||||
destination.error(err);
|
||||
}
|
||||
};
|
||||
SwitchFirstMapSubscriber.prototype.notifyError = function (err) {
|
||||
this.destination.error(err);
|
||||
};
|
||||
SwitchFirstMapSubscriber.prototype.notifyComplete = function (innerSub) {
|
||||
this.remove(innerSub);
|
||||
this.hasSubscription = false;
|
||||
if (this.hasCompleted) {
|
||||
this.destination.complete();
|
||||
}
|
||||
};
|
||||
return SwitchFirstMapSubscriber;
|
||||
}(OuterSubscriber_1.OuterSubscriber));
|
||||
//# sourceMappingURL=exhaustMap.js.map
|
1
node_modules/rxjs/operators/exhaustMap.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/exhaustMap.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
38
node_modules/rxjs/operators/expand.d.ts
generated
vendored
Normal file
38
node_modules/rxjs/operators/expand.d.ts
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { Operator } from '../Operator';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { Subscription } from '../Subscription';
|
||||
import { OuterSubscriber } from '../OuterSubscriber';
|
||||
import { InnerSubscriber } from '../InnerSubscriber';
|
||||
import { MonoTypeOperatorFunction, OperatorFunction } from '../interfaces';
|
||||
export declare function expand<T>(project: (value: T, index: number) => Observable<T>, concurrent?: number, scheduler?: IScheduler): MonoTypeOperatorFunction<T>;
|
||||
export declare function expand<T, R>(project: (value: T, index: number) => Observable<R>, concurrent?: number, scheduler?: IScheduler): OperatorFunction<T, R>;
|
||||
export declare class ExpandOperator<T, R> implements Operator<T, R> {
|
||||
private project;
|
||||
private concurrent;
|
||||
private scheduler;
|
||||
constructor(project: (value: T, index: number) => Observable<R>, concurrent: number, scheduler: IScheduler);
|
||||
call(subscriber: Subscriber<R>, source: any): any;
|
||||
}
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
export declare class ExpandSubscriber<T, R> extends OuterSubscriber<T, R> {
|
||||
private project;
|
||||
private concurrent;
|
||||
private scheduler;
|
||||
private index;
|
||||
private active;
|
||||
private hasCompleted;
|
||||
private buffer;
|
||||
constructor(destination: Subscriber<R>, project: (value: T, index: number) => Observable<R>, concurrent: number, scheduler: IScheduler);
|
||||
private static dispatch<T, R>(arg);
|
||||
protected _next(value: any): void;
|
||||
private subscribeToProjection(result, value, index);
|
||||
protected _complete(): void;
|
||||
notifyNext(outerValue: T, innerValue: R, outerIndex: number, innerIndex: number, innerSub: InnerSubscriber<T, R>): void;
|
||||
notifyComplete(innerSub: Subscription): void;
|
||||
}
|
151
node_modules/rxjs/operators/expand.js
generated
vendored
Normal file
151
node_modules/rxjs/operators/expand.js
generated
vendored
Normal file
@@ -0,0 +1,151 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var tryCatch_1 = require('../util/tryCatch');
|
||||
var errorObject_1 = require('../util/errorObject');
|
||||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||||
/* tslint:enable:max-line-length */
|
||||
/**
|
||||
* Recursively projects each source value to an Observable which is merged in
|
||||
* the output Observable.
|
||||
*
|
||||
* <span class="informal">It's similar to {@link mergeMap}, but applies the
|
||||
* projection function to every source value as well as every output value.
|
||||
* It's recursive.</span>
|
||||
*
|
||||
* <img src="./img/expand.png" width="100%">
|
||||
*
|
||||
* Returns an Observable that emits items based on applying a function that you
|
||||
* supply to each item emitted by the source Observable, where that function
|
||||
* returns an Observable, and then merging those resulting Observables and
|
||||
* emitting the results of this merger. *Expand* will re-emit on the output
|
||||
* Observable every source value. Then, each output value is given to the
|
||||
* `project` function which returns an inner Observable to be merged on the
|
||||
* output Observable. Those output values resulting from the projection are also
|
||||
* given to the `project` function to produce new output values. This is how
|
||||
* *expand* behaves recursively.
|
||||
*
|
||||
* @example <caption>Start emitting the powers of two on every click, at most 10 of them</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var powersOfTwo = clicks
|
||||
* .mapTo(1)
|
||||
* .expand(x => Rx.Observable.of(2 * x).delay(1000))
|
||||
* .take(10);
|
||||
* powersOfTwo.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link mergeMap}
|
||||
* @see {@link mergeScan}
|
||||
*
|
||||
* @param {function(value: T, index: number) => Observable} project A function
|
||||
* that, when applied to an item emitted by the source or the output Observable,
|
||||
* returns an Observable.
|
||||
* @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input
|
||||
* Observables being subscribed to concurrently.
|
||||
* @param {Scheduler} [scheduler=null] The IScheduler to use for subscribing to
|
||||
* each projected inner Observable.
|
||||
* @return {Observable} An Observable that emits the source values and also
|
||||
* result of applying the projection function to each value emitted on the
|
||||
* output Observable and and merging the results of the Observables obtained
|
||||
* from this transformation.
|
||||
* @method expand
|
||||
* @owner Observable
|
||||
*/
|
||||
function expand(project, concurrent, scheduler) {
|
||||
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
|
||||
if (scheduler === void 0) { scheduler = undefined; }
|
||||
concurrent = (concurrent || 0) < 1 ? Number.POSITIVE_INFINITY : concurrent;
|
||||
return function (source) { return source.lift(new ExpandOperator(project, concurrent, scheduler)); };
|
||||
}
|
||||
exports.expand = expand;
|
||||
var ExpandOperator = (function () {
|
||||
function ExpandOperator(project, concurrent, scheduler) {
|
||||
this.project = project;
|
||||
this.concurrent = concurrent;
|
||||
this.scheduler = scheduler;
|
||||
}
|
||||
ExpandOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new ExpandSubscriber(subscriber, this.project, this.concurrent, this.scheduler));
|
||||
};
|
||||
return ExpandOperator;
|
||||
}());
|
||||
exports.ExpandOperator = ExpandOperator;
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var ExpandSubscriber = (function (_super) {
|
||||
__extends(ExpandSubscriber, _super);
|
||||
function ExpandSubscriber(destination, project, concurrent, scheduler) {
|
||||
_super.call(this, destination);
|
||||
this.project = project;
|
||||
this.concurrent = concurrent;
|
||||
this.scheduler = scheduler;
|
||||
this.index = 0;
|
||||
this.active = 0;
|
||||
this.hasCompleted = false;
|
||||
if (concurrent < Number.POSITIVE_INFINITY) {
|
||||
this.buffer = [];
|
||||
}
|
||||
}
|
||||
ExpandSubscriber.dispatch = function (arg) {
|
||||
var subscriber = arg.subscriber, result = arg.result, value = arg.value, index = arg.index;
|
||||
subscriber.subscribeToProjection(result, value, index);
|
||||
};
|
||||
ExpandSubscriber.prototype._next = function (value) {
|
||||
var destination = this.destination;
|
||||
if (destination.closed) {
|
||||
this._complete();
|
||||
return;
|
||||
}
|
||||
var index = this.index++;
|
||||
if (this.active < this.concurrent) {
|
||||
destination.next(value);
|
||||
var result = tryCatch_1.tryCatch(this.project)(value, index);
|
||||
if (result === errorObject_1.errorObject) {
|
||||
destination.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
else if (!this.scheduler) {
|
||||
this.subscribeToProjection(result, value, index);
|
||||
}
|
||||
else {
|
||||
var state = { subscriber: this, result: result, value: value, index: index };
|
||||
this.add(this.scheduler.schedule(ExpandSubscriber.dispatch, 0, state));
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.buffer.push(value);
|
||||
}
|
||||
};
|
||||
ExpandSubscriber.prototype.subscribeToProjection = function (result, value, index) {
|
||||
this.active++;
|
||||
this.add(subscribeToResult_1.subscribeToResult(this, result, value, index));
|
||||
};
|
||||
ExpandSubscriber.prototype._complete = function () {
|
||||
this.hasCompleted = true;
|
||||
if (this.hasCompleted && this.active === 0) {
|
||||
this.destination.complete();
|
||||
}
|
||||
};
|
||||
ExpandSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
|
||||
this._next(innerValue);
|
||||
};
|
||||
ExpandSubscriber.prototype.notifyComplete = function (innerSub) {
|
||||
var buffer = this.buffer;
|
||||
this.remove(innerSub);
|
||||
this.active--;
|
||||
if (buffer && buffer.length > 0) {
|
||||
this._next(buffer.shift());
|
||||
}
|
||||
if (this.hasCompleted && this.active === 0) {
|
||||
this.destination.complete();
|
||||
}
|
||||
};
|
||||
return ExpandSubscriber;
|
||||
}(OuterSubscriber_1.OuterSubscriber));
|
||||
exports.ExpandSubscriber = ExpandSubscriber;
|
||||
//# sourceMappingURL=expand.js.map
|
1
node_modules/rxjs/operators/expand.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/expand.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/rxjs/operators/filter.d.ts
generated
vendored
Normal file
3
node_modules/rxjs/operators/filter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { OperatorFunction, MonoTypeOperatorFunction } from '../interfaces';
|
||||
export declare function filter<T, S extends T>(predicate: (value: T, index: number) => value is S, thisArg?: any): OperatorFunction<T, S>;
|
||||
export declare function filter<T>(predicate: (value: T, index: number) => boolean, thisArg?: any): MonoTypeOperatorFunction<T>;
|
94
node_modules/rxjs/operators/filter.js
generated
vendored
Normal file
94
node_modules/rxjs/operators/filter.js
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Subscriber_1 = require('../Subscriber');
|
||||
/* tslint:enable:max-line-length */
|
||||
/**
|
||||
* Filter items emitted by the source Observable by only emitting those that
|
||||
* satisfy a specified predicate.
|
||||
*
|
||||
* <span class="informal">Like
|
||||
* [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter),
|
||||
* it only emits a value from the source if it passes a criterion function.</span>
|
||||
*
|
||||
* <img src="./img/filter.png" width="100%">
|
||||
*
|
||||
* Similar to the well-known `Array.prototype.filter` method, this operator
|
||||
* takes values from the source Observable, passes them through a `predicate`
|
||||
* function and only emits those values that yielded `true`.
|
||||
*
|
||||
* @example <caption>Emit only click events whose target was a DIV element</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var clicksOnDivs = clicks.filter(ev => ev.target.tagName === 'DIV');
|
||||
* clicksOnDivs.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link distinct}
|
||||
* @see {@link distinctUntilChanged}
|
||||
* @see {@link distinctUntilKeyChanged}
|
||||
* @see {@link ignoreElements}
|
||||
* @see {@link partition}
|
||||
* @see {@link skip}
|
||||
*
|
||||
* @param {function(value: T, index: number): boolean} predicate A function that
|
||||
* evaluates each value emitted by the source Observable. If it returns `true`,
|
||||
* the value is emitted, if `false` the value is not passed to the output
|
||||
* Observable. The `index` parameter is the number `i` for the i-th source
|
||||
* emission that has happened since the subscription, starting from the number
|
||||
* `0`.
|
||||
* @param {any} [thisArg] An optional argument to determine the value of `this`
|
||||
* in the `predicate` function.
|
||||
* @return {Observable} An Observable of values from the source that were
|
||||
* allowed by the `predicate` function.
|
||||
* @method filter
|
||||
* @owner Observable
|
||||
*/
|
||||
function filter(predicate, thisArg) {
|
||||
return function filterOperatorFunction(source) {
|
||||
return source.lift(new FilterOperator(predicate, thisArg));
|
||||
};
|
||||
}
|
||||
exports.filter = filter;
|
||||
var FilterOperator = (function () {
|
||||
function FilterOperator(predicate, thisArg) {
|
||||
this.predicate = predicate;
|
||||
this.thisArg = thisArg;
|
||||
}
|
||||
FilterOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new FilterSubscriber(subscriber, this.predicate, this.thisArg));
|
||||
};
|
||||
return FilterOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var FilterSubscriber = (function (_super) {
|
||||
__extends(FilterSubscriber, _super);
|
||||
function FilterSubscriber(destination, predicate, thisArg) {
|
||||
_super.call(this, destination);
|
||||
this.predicate = predicate;
|
||||
this.thisArg = thisArg;
|
||||
this.count = 0;
|
||||
}
|
||||
// the try catch block below is left specifically for
|
||||
// optimization and perf reasons. a tryCatcher is not necessary here.
|
||||
FilterSubscriber.prototype._next = function (value) {
|
||||
var result;
|
||||
try {
|
||||
result = this.predicate.call(this.thisArg, value, this.count++);
|
||||
}
|
||||
catch (err) {
|
||||
this.destination.error(err);
|
||||
return;
|
||||
}
|
||||
if (result) {
|
||||
this.destination.next(value);
|
||||
}
|
||||
};
|
||||
return FilterSubscriber;
|
||||
}(Subscriber_1.Subscriber));
|
||||
//# sourceMappingURL=filter.js.map
|
1
node_modules/rxjs/operators/filter.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/filter.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
10
node_modules/rxjs/operators/finalize.d.ts
generated
vendored
Normal file
10
node_modules/rxjs/operators/finalize.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { MonoTypeOperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* Returns an Observable that mirrors the source Observable, but will call a specified function when
|
||||
* the source terminates on complete or error.
|
||||
* @param {function} callback Function to be called when source terminates.
|
||||
* @return {Observable} An Observable that mirrors the source, but will call the specified function on termination.
|
||||
* @method finally
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function finalize<T>(callback: () => void): MonoTypeOperatorFunction<T>;
|
43
node_modules/rxjs/operators/finalize.js
generated
vendored
Normal file
43
node_modules/rxjs/operators/finalize.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Subscriber_1 = require('../Subscriber');
|
||||
var Subscription_1 = require('../Subscription');
|
||||
/**
|
||||
* Returns an Observable that mirrors the source Observable, but will call a specified function when
|
||||
* the source terminates on complete or error.
|
||||
* @param {function} callback Function to be called when source terminates.
|
||||
* @return {Observable} An Observable that mirrors the source, but will call the specified function on termination.
|
||||
* @method finally
|
||||
* @owner Observable
|
||||
*/
|
||||
function finalize(callback) {
|
||||
return function (source) { return source.lift(new FinallyOperator(callback)); };
|
||||
}
|
||||
exports.finalize = finalize;
|
||||
var FinallyOperator = (function () {
|
||||
function FinallyOperator(callback) {
|
||||
this.callback = callback;
|
||||
}
|
||||
FinallyOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new FinallySubscriber(subscriber, this.callback));
|
||||
};
|
||||
return FinallyOperator;
|
||||
}());
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var FinallySubscriber = (function (_super) {
|
||||
__extends(FinallySubscriber, _super);
|
||||
function FinallySubscriber(destination, callback) {
|
||||
_super.call(this, destination);
|
||||
this.add(new Subscription_1.Subscription(callback));
|
||||
}
|
||||
return FinallySubscriber;
|
||||
}(Subscriber_1.Subscriber));
|
||||
//# sourceMappingURL=finalize.js.map
|
1
node_modules/rxjs/operators/finalize.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/finalize.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"finalize.js","sourceRoot":"","sources":["../../src/operators/finalize.ts"],"names":[],"mappings":";;;;;;AACA,2BAA2B,eAAe,CAAC,CAAA;AAC3C,6BAA4C,iBAAiB,CAAC,CAAA;AAI9D;;;;;;;GAOG;AACH,kBAA4B,QAAoB;IAC9C,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC,EAA1C,CAA0C,CAAC;AAC/E,CAAC;AAFe,gBAAQ,WAEvB,CAAA;AAED;IACE,yBAAoB,QAAoB;QAApB,aAAQ,GAAR,QAAQ,CAAY;IACxC,CAAC;IAED,8BAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,iBAAiB,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC5E,CAAC;IACH,sBAAC;AAAD,CAAC,AAPD,IAOC;AAED;;;;GAIG;AACH;IAAmC,qCAAa;IAC9C,2BAAY,WAA0B,EAAE,QAAoB;QAC1D,kBAAM,WAAW,CAAC,CAAC;QACnB,IAAI,CAAC,GAAG,CAAC,IAAI,2BAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvC,CAAC;IACH,wBAAC;AAAD,CAAC,AALD,CAAmC,uBAAU,GAK5C","sourcesContent":["import { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { Subscription, TeardownLogic } from '../Subscription';\nimport { Observable } from '../Observable';\nimport { MonoTypeOperatorFunction } from '../interfaces';\n\n/**\n * Returns an Observable that mirrors the source Observable, but will call a specified function when\n * the source terminates on complete or error.\n * @param {function} callback Function to be called when source terminates.\n * @return {Observable} An Observable that mirrors the source, but will call the specified function on termination.\n * @method finally\n * @owner Observable\n */\nexport function finalize<T>(callback: () => void): MonoTypeOperatorFunction<T> {\n return (source: Observable<T>) => source.lift(new FinallyOperator(callback));\n}\n\nclass FinallyOperator<T> implements Operator<T, T> {\n constructor(private callback: () => void) {\n }\n\n call(subscriber: Subscriber<T>, source: any): TeardownLogic {\n return source.subscribe(new FinallySubscriber(subscriber, this.callback));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass FinallySubscriber<T> extends Subscriber<T> {\n constructor(destination: Subscriber<T>, callback: () => void) {\n super(destination);\n this.add(new Subscription(callback));\n }\n}\n"]}
|
32
node_modules/rxjs/operators/find.d.ts
generated
vendored
Normal file
32
node_modules/rxjs/operators/find.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { Operator } from '../Operator';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { OperatorFunction, MonoTypeOperatorFunction } from '../interfaces';
|
||||
export declare function find<T, S extends T>(predicate: (value: T, index: number, source: Observable<T>) => value is S, thisArg?: any): OperatorFunction<T, S>;
|
||||
export declare function find<T, S extends T>(predicate: (value: T, index: number) => value is S, thisArg?: any): OperatorFunction<T, S>;
|
||||
export declare function find<T>(predicate: (value: T, index: number, source: Observable<T>) => boolean, thisArg?: any): MonoTypeOperatorFunction<T>;
|
||||
export declare function find<T>(predicate: (value: T, index: number) => boolean, thisArg?: any): MonoTypeOperatorFunction<T>;
|
||||
export declare class FindValueOperator<T> implements Operator<T, T> {
|
||||
private predicate;
|
||||
private source;
|
||||
private yieldIndex;
|
||||
private thisArg;
|
||||
constructor(predicate: (value: T, index: number, source: Observable<T>) => boolean, source: Observable<T>, yieldIndex: boolean, thisArg?: any);
|
||||
call(observer: Subscriber<T>, source: any): any;
|
||||
}
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
export declare class FindValueSubscriber<T> extends Subscriber<T> {
|
||||
private predicate;
|
||||
private source;
|
||||
private yieldIndex;
|
||||
private thisArg;
|
||||
private index;
|
||||
constructor(destination: Subscriber<T>, predicate: (value: T, index: number, source: Observable<T>) => boolean, source: Observable<T>, yieldIndex: boolean, thisArg?: any);
|
||||
private notifyComplete(value);
|
||||
protected _next(value: T): void;
|
||||
protected _complete(): void;
|
||||
}
|
100
node_modules/rxjs/operators/find.js
generated
vendored
Normal file
100
node_modules/rxjs/operators/find.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Subscriber_1 = require('../Subscriber');
|
||||
/**
|
||||
* Emits only the first value emitted by the source Observable that meets some
|
||||
* condition.
|
||||
*
|
||||
* <span class="informal">Finds the first value that passes some test and emits
|
||||
* that.</span>
|
||||
*
|
||||
* <img src="./img/find.png" width="100%">
|
||||
*
|
||||
* `find` searches for the first item in the source Observable that matches the
|
||||
* specified condition embodied by the `predicate`, and returns the first
|
||||
* occurrence in the source. Unlike {@link first}, the `predicate` is required
|
||||
* in `find`, and does not emit an error if a valid value is not found.
|
||||
*
|
||||
* @example <caption>Find and emit the first click that happens on a DIV element</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var result = clicks.find(ev => ev.target.tagName === 'DIV');
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link filter}
|
||||
* @see {@link first}
|
||||
* @see {@link findIndex}
|
||||
* @see {@link take}
|
||||
*
|
||||
* @param {function(value: T, index: number, source: Observable<T>): boolean} predicate
|
||||
* A function called with each item to test for condition matching.
|
||||
* @param {any} [thisArg] An optional argument to determine the value of `this`
|
||||
* in the `predicate` function.
|
||||
* @return {Observable<T>} An Observable of the first item that matches the
|
||||
* condition.
|
||||
* @method find
|
||||
* @owner Observable
|
||||
*/
|
||||
function find(predicate, thisArg) {
|
||||
if (typeof predicate !== 'function') {
|
||||
throw new TypeError('predicate is not a function');
|
||||
}
|
||||
return function (source) { return source.lift(new FindValueOperator(predicate, source, false, thisArg)); };
|
||||
}
|
||||
exports.find = find;
|
||||
var FindValueOperator = (function () {
|
||||
function FindValueOperator(predicate, source, yieldIndex, thisArg) {
|
||||
this.predicate = predicate;
|
||||
this.source = source;
|
||||
this.yieldIndex = yieldIndex;
|
||||
this.thisArg = thisArg;
|
||||
}
|
||||
FindValueOperator.prototype.call = function (observer, source) {
|
||||
return source.subscribe(new FindValueSubscriber(observer, this.predicate, this.source, this.yieldIndex, this.thisArg));
|
||||
};
|
||||
return FindValueOperator;
|
||||
}());
|
||||
exports.FindValueOperator = FindValueOperator;
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var FindValueSubscriber = (function (_super) {
|
||||
__extends(FindValueSubscriber, _super);
|
||||
function FindValueSubscriber(destination, predicate, source, yieldIndex, thisArg) {
|
||||
_super.call(this, destination);
|
||||
this.predicate = predicate;
|
||||
this.source = source;
|
||||
this.yieldIndex = yieldIndex;
|
||||
this.thisArg = thisArg;
|
||||
this.index = 0;
|
||||
}
|
||||
FindValueSubscriber.prototype.notifyComplete = function (value) {
|
||||
var destination = this.destination;
|
||||
destination.next(value);
|
||||
destination.complete();
|
||||
};
|
||||
FindValueSubscriber.prototype._next = function (value) {
|
||||
var _a = this, predicate = _a.predicate, thisArg = _a.thisArg;
|
||||
var index = this.index++;
|
||||
try {
|
||||
var result = predicate.call(thisArg || this, value, index, this.source);
|
||||
if (result) {
|
||||
this.notifyComplete(this.yieldIndex ? index : value);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
this.destination.error(err);
|
||||
}
|
||||
};
|
||||
FindValueSubscriber.prototype._complete = function () {
|
||||
this.notifyComplete(this.yieldIndex ? -1 : undefined);
|
||||
};
|
||||
return FindValueSubscriber;
|
||||
}(Subscriber_1.Subscriber));
|
||||
exports.FindValueSubscriber = FindValueSubscriber;
|
||||
//# sourceMappingURL=find.js.map
|
1
node_modules/rxjs/operators/find.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/find.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
37
node_modules/rxjs/operators/findIndex.d.ts
generated
vendored
Normal file
37
node_modules/rxjs/operators/findIndex.d.ts
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { OperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* Emits only the index of the first value emitted by the source Observable that
|
||||
* meets some condition.
|
||||
*
|
||||
* <span class="informal">It's like {@link find}, but emits the index of the
|
||||
* found value, not the value itself.</span>
|
||||
*
|
||||
* <img src="./img/findIndex.png" width="100%">
|
||||
*
|
||||
* `findIndex` searches for the first item in the source Observable that matches
|
||||
* the specified condition embodied by the `predicate`, and returns the
|
||||
* (zero-based) index of the first occurrence in the source. Unlike
|
||||
* {@link first}, the `predicate` is required in `findIndex`, and does not emit
|
||||
* an error if a valid value is not found.
|
||||
*
|
||||
* @example <caption>Emit the index of first click that happens on a DIV element</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var result = clicks.findIndex(ev => ev.target.tagName === 'DIV');
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link filter}
|
||||
* @see {@link find}
|
||||
* @see {@link first}
|
||||
* @see {@link take}
|
||||
*
|
||||
* @param {function(value: T, index: number, source: Observable<T>): boolean} predicate
|
||||
* A function called with each item to test for condition matching.
|
||||
* @param {any} [thisArg] An optional argument to determine the value of `this`
|
||||
* in the `predicate` function.
|
||||
* @return {Observable} An Observable of the index of the first item that
|
||||
* matches the condition.
|
||||
* @method find
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function findIndex<T>(predicate: (value: T, index: number, source: Observable<T>) => boolean, thisArg?: any): OperatorFunction<T, number>;
|
41
node_modules/rxjs/operators/findIndex.js
generated
vendored
Normal file
41
node_modules/rxjs/operators/findIndex.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
var find_1 = require('../operators/find');
|
||||
/**
|
||||
* Emits only the index of the first value emitted by the source Observable that
|
||||
* meets some condition.
|
||||
*
|
||||
* <span class="informal">It's like {@link find}, but emits the index of the
|
||||
* found value, not the value itself.</span>
|
||||
*
|
||||
* <img src="./img/findIndex.png" width="100%">
|
||||
*
|
||||
* `findIndex` searches for the first item in the source Observable that matches
|
||||
* the specified condition embodied by the `predicate`, and returns the
|
||||
* (zero-based) index of the first occurrence in the source. Unlike
|
||||
* {@link first}, the `predicate` is required in `findIndex`, and does not emit
|
||||
* an error if a valid value is not found.
|
||||
*
|
||||
* @example <caption>Emit the index of first click that happens on a DIV element</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var result = clicks.findIndex(ev => ev.target.tagName === 'DIV');
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link filter}
|
||||
* @see {@link find}
|
||||
* @see {@link first}
|
||||
* @see {@link take}
|
||||
*
|
||||
* @param {function(value: T, index: number, source: Observable<T>): boolean} predicate
|
||||
* A function called with each item to test for condition matching.
|
||||
* @param {any} [thisArg] An optional argument to determine the value of `this`
|
||||
* in the `predicate` function.
|
||||
* @return {Observable} An Observable of the index of the first item that
|
||||
* matches the condition.
|
||||
* @method find
|
||||
* @owner Observable
|
||||
*/
|
||||
function findIndex(predicate, thisArg) {
|
||||
return function (source) { return source.lift(new find_1.FindValueOperator(predicate, source, true, thisArg)); };
|
||||
}
|
||||
exports.findIndex = findIndex;
|
||||
//# sourceMappingURL=findIndex.js.map
|
1
node_modules/rxjs/operators/findIndex.js.map
generated
vendored
Normal file
1
node_modules/rxjs/operators/findIndex.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"findIndex.js","sourceRoot":"","sources":["../../src/operators/findIndex.ts"],"names":[],"mappings":";AACA,qBAAkC,mBAAmB,CAAC,CAAA;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,mBAA6B,SAAsE,EACtE,OAAa;IACxC,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,wBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAoB,EAAvF,CAAuF,CAAC;AAC5H,CAAC;AAHe,iBAAS,YAGxB,CAAA","sourcesContent":["import { Observable } from '../Observable';\nimport { FindValueOperator } from '../operators/find';\nimport { OperatorFunction } from '../interfaces';\n/**\n * Emits only the index of the first value emitted by the source Observable that\n * meets some condition.\n *\n * <span class=\"informal\">It's like {@link find}, but emits the index of the\n * found value, not the value itself.</span>\n *\n * <img src=\"./img/findIndex.png\" width=\"100%\">\n *\n * `findIndex` searches for the first item in the source Observable that matches\n * the specified condition embodied by the `predicate`, and returns the\n * (zero-based) index of the first occurrence in the source. Unlike\n * {@link first}, the `predicate` is required in `findIndex`, and does not emit\n * an error if a valid value is not found.\n *\n * @example <caption>Emit the index of first click that happens on a DIV element</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.findIndex(ev => ev.target.tagName === 'DIV');\n * result.subscribe(x => console.log(x));\n *\n * @see {@link filter}\n * @see {@link find}\n * @see {@link first}\n * @see {@link take}\n *\n * @param {function(value: T, index: number, source: Observable<T>): boolean} predicate\n * A function called with each item to test for condition matching.\n * @param {any} [thisArg] An optional argument to determine the value of `this`\n * in the `predicate` function.\n * @return {Observable} An Observable of the index of the first item that\n * matches the condition.\n * @method find\n * @owner Observable\n */\nexport function findIndex<T>(predicate: (value: T, index: number, source: Observable<T>) => boolean,\n thisArg?: any): OperatorFunction<T, number> {\n return (source: Observable<T>) => source.lift(new FindValueOperator(predicate, source, true, thisArg)) as Observable<any>;\n}\n"]}
|
8
node_modules/rxjs/operators/first.d.ts
generated
vendored
Normal file
8
node_modules/rxjs/operators/first.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { OperatorFunction, MonoTypeOperatorFunction } from '../interfaces';
|
||||
export declare function first<T, S extends T>(predicate: (value: T, index: number, source: Observable<T>) => value is S): OperatorFunction<T, S>;
|
||||
export declare function first<T, S extends T, R>(predicate: (value: T | S, index: number, source: Observable<T>) => value is S, resultSelector: (value: S, index: number) => R, defaultValue?: R): OperatorFunction<T, R>;
|
||||
export declare function first<T, S extends T>(predicate: (value: T, index: number, source: Observable<T>) => value is S, resultSelector: void, defaultValue?: S): OperatorFunction<T, S>;
|
||||
export declare function first<T>(predicate?: (value: T, index: number, source: Observable<T>) => boolean): MonoTypeOperatorFunction<T>;
|
||||
export declare function first<T, R>(predicate: (value: T, index: number, source: Observable<T>) => boolean, resultSelector?: (value: T, index: number) => R, defaultValue?: R): OperatorFunction<T, R>;
|
||||
export declare function first<T>(predicate: (value: T, index: number, source: Observable<T>) => boolean, resultSelector: void, defaultValue?: T): MonoTypeOperatorFunction<T>;
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user