Sha256: c8f04040d5060aaf22fc5eaf3301f1e5576c86b367f9f91bee6ae0f7ce63ff1d

Contents?: true

Size: 1.82 KB

Versions: 49

Compression:

Stored size: 1.82 KB

Contents

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>;

Version data entries

49 entries across 49 versions & 4 rubygems

Version Path
ilog-0.4.1 node_modules/rxjs/operators/elementAt.d.ts
ilog-0.4.0 node_modules/rxjs/operators/elementAt.d.ts
ilog-0.3.3 node_modules/rxjs/operators/elementAt.d.ts
govuk_publishing_components-18.0.0 node_modules/rxjs/operators/elementAt.d.ts
govuk_publishing_components-17.21.0 node_modules/rxjs/operators/elementAt.d.ts
govuk_publishing_components-17.20.0 node_modules/rxjs/operators/elementAt.d.ts
govuk_publishing_components-17.19.1 node_modules/rxjs/operators/elementAt.d.ts
govuk_publishing_components-17.19.0 node_modules/rxjs/operators/elementAt.d.ts
govuk_publishing_components-17.18.0 node_modules/rxjs/operators/elementAt.d.ts
govuk_publishing_components-17.17.0 node_modules/rxjs/operators/elementAt.d.ts
govuk_publishing_components-17.16.0 node_modules/rxjs/operators/elementAt.d.ts
govuk_publishing_components-17.15.0 node_modules/rxjs/operators/elementAt.d.ts
govuk_publishing_components-17.14.0 node_modules/rxjs/operators/elementAt.d.ts
govuk_publishing_components-17.13.0 node_modules/rxjs/operators/elementAt.d.ts
govuk_publishing_components-17.12.2 node_modules/rxjs/operators/elementAt.d.ts
govuk_publishing_components-17.12.1 node_modules/rxjs/operators/elementAt.d.ts
govuk_publishing_components-17.12.0 node_modules/rxjs/operators/elementAt.d.ts
govuk_publishing_components-17.11.0 node_modules/rxjs/operators/elementAt.d.ts
govuk_publishing_components-17.10.0 node_modules/rxjs/operators/elementAt.d.ts
govuk_publishing_components-17.9.0 node_modules/rxjs/operators/elementAt.d.ts