1 line
4.6 KiB
Plaintext
1 line
4.6 KiB
Plaintext
|
{"version":3,"file":"first.js","sourceRoot":"","sources":["../../src/operator/first.ts"],"names":[],"mappings":";AACA,sBAAqC,oBAAoB,CAAC,CAAA;AAuB1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,eAAiD,SAAuE,EAC5F,cAAwD,EACxD,YAAgB;IAC1C,MAAM,CAAC,aAAW,CAAC,SAAS,EAAE,cAAqB,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC;AAC3E,CAAC;AAJe,aAAK,QAIpB,CAAA","sourcesContent":["import { Observable } from '../Observable';\nimport { first as higherOrder } from '../operators/first';\n\n/* tslint:disable:max-line-length */\nexport function first<T, S extends T>(this: Observable<T>,\n predicate: (value: T, index: number, source: Observable<T>) => value is S): Observable<S>;\nexport function first<T, S extends T, R>(this: Observable<T>,\n predicate: (value: T | S, index: number, source: Observable<T>) => value is S,\n resultSelector: (value: S, index: number) => R, defaultValue?: R): Observable<R>;\nexport function first<T, S extends T>(this: Observable<T>,\n predicate: (value: T, index: number, source: Observable<T>) => value is S,\n resultSelector: void,\n defaultValue?: S): Observable<S>;\nexport function first<T>(this: Observable<T>,\n predicate?: (value: T, index: number, source: Observable<T>) => boolean): Observable<T>;\nexport function first<T, R>(this: Observable<T>,\n predicate: (value: T, index: number, source: Observable<T>) => boolean,\n resultSelector?: (value: T, index: number) => R,\n defaultValue?: R): Observable<R>;\nexport function first<T>(this: Observable<T>,\n predicate: (value: T, index: number, source: Observable<T>) => boolean,\n resultSelector: void,\n defaultValue?: T): Observable<T>;\n\n/**\n * Emits only the first value (or the first value that meets some condition)\n * emitted by the source Observable.\n *\n * <span class=\"informal\">Emits only the first value. Or emits only the first\n * value that passes some test.</span>\n *\n * <img src=\"./img/first.png\" width=\"100%\">\n *\n * If called with no arguments, `first` emits the first value of the source\n * Observable, then completes. If called with a `predicate` function, `first`\n * emits the first value of the source that matches the specified condition. It\n * may also take a `resultSelector` function to produce the output value from\n * the input value, and a `defaultValue` to emit in case the source completes\n * before it is able to emit a valid value. Throws an error if `defaultValue`\n * was not provided and a matching element is not found.\n *\n * @example <caption>Emit only the first click that happens on the DOM</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.first();\n * result.subscribe(x => console.log(x));\n *\n * @example <caption>Emits the first click that happens on a DIV</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.first(ev => ev.target.tagName === 'DIV');\n * result.subscribe(x => console.log(x));\n *\n * @see {@link filter}\n * @see {@link find}\n * @see {@link take}\n *\n * @throws {EmptyError} Delivers an EmptyError to the Observer's `error`\n * callback if the Observable completes before any `next` notification was sent.\n *\n * @param {function(value: T, index: number, source: Observable<T>): boolean} [predicate]\n * An optional function called with each item to test for condition matching.\n * @param {function(value: T, index: number): R} [resultSelector] A function to\n * produce the value on the output Observable based on the values\n * and the indices of the source Observable. The arguments passed to this\n * function are:\n * - `value`: the value that was emitted on the source.\n * - `index`: the \"index\" of the value from the s
|