Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / internal / operators / elementAt.d.ts
1 import { MonoTypeOperatorFunction } from '../types';
2 /**
3  * Emits the single value at the specified `index` in a sequence of emissions
4  * from the source Observable.
5  *
6  * <span class="informal">Emits only the i-th value, then completes.</span>
7  *
8  * ![](elementAt.png)
9  *
10  * `elementAt` returns an Observable that emits the item at the specified
11  * `index` in the source Observable, or a default value if that `index` is out
12  * of range and the `default` argument is provided. If the `default` argument is
13  * not given and the `index` is out of range, the output Observable will emit an
14  * `ArgumentOutOfRangeError` error.
15  *
16  * ## Example
17  * Emit only the third click event
18  * ```ts
19  * import { fromEvent } from 'rxjs';
20  * import { elementAt } from 'rxjs/operators';
21  *
22  * const clicks = fromEvent(document, 'click');
23  * const result = clicks.pipe(elementAt(2));
24  * result.subscribe(x => console.log(x));
25  *
26  * // Results in:
27  * // click 1 = nothing
28  * // click 2 = nothing
29  * // click 3 = MouseEvent object logged to console
30  * ```
31  *
32  * @see {@link first}
33  * @see {@link last}
34  * @see {@link skip}
35  * @see {@link single}
36  * @see {@link take}
37  *
38  * @throws {ArgumentOutOfRangeError} When using `elementAt(i)`, it delivers an
39  * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0` or the
40  * Observable has completed before emitting the i-th `next` notification.
41  *
42  * @param {number} index Is the number `i` for the i-th source emission that has
43  * happened since the subscription, starting from the number `0`.
44  * @param {T} [defaultValue] The default value returned for missing indices.
45  * @return {Observable} An Observable that emits a single item, if it is found.
46  * Otherwise, will emit the default value if given. If not, then emits an error.
47  * @method elementAt
48  * @owner Observable
49  */
50 export declare function elementAt<T>(index: number, defaultValue?: T): MonoTypeOperatorFunction<T>;