source: trip-planner-front/node_modules/rxjs/src/internal/operators/startWith.ts

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 4.4 KB
Line 
1import { Observable } from '../Observable';
2import { concat } from '../observable/concat';
3import { isScheduler } from '../util/isScheduler';
4import { MonoTypeOperatorFunction, OperatorFunction, SchedulerLike } from '../types';
5
6/* tslint:disable:max-line-length */
7/** @deprecated use {@link scheduled} and {@link concatAll} (e.g. `scheduled([[a, b, c], source], scheduler).pipe(concatAll())`) */
8export function startWith<T>(scheduler: SchedulerLike): MonoTypeOperatorFunction<T>;
9/** @deprecated use {@link scheduled} and {@link concatAll} (e.g. `scheduled([[a, b, c], source], scheduler).pipe(concatAll())`) */
10export function startWith<T, D>(v1: D, scheduler: SchedulerLike): OperatorFunction<T, T | D>;
11/** @deprecated use {@link scheduled} and {@link concatAll} (e.g. `scheduled([[a, b, c], source], scheduler).pipe(concatAll())`) */
12export function startWith<T, D, E>(v1: D, v2: E, scheduler: SchedulerLike): OperatorFunction<T, T | D | E>;
13/** @deprecated use {@link scheduled} and {@link concatAll} (e.g. `scheduled([[a, b, c], source], scheduler).pipe(concatAll())`) */
14export function startWith<T, D, E, F>(v1: D, v2: E, v3: F, scheduler: SchedulerLike): OperatorFunction<T, T | D | E | F>;
15/** @deprecated use {@link scheduled} and {@link concatAll} (e.g. `scheduled([[a, b, c], source], scheduler).pipe(concatAll())`) */
16export function startWith<T, D, E, F, G>(v1: D, v2: E, v3: F, v4: G, scheduler: SchedulerLike): OperatorFunction<T, T | D | E | F | G>;
17/** @deprecated use {@link scheduled} and {@link concatAll} (e.g. `scheduled([[a, b, c], source], scheduler).pipe(concatAll())`) */
18export function startWith<T, D, E, F, G, H>(v1: D, v2: E, v3: F, v4: G, v5: H, scheduler: SchedulerLike): OperatorFunction<T, T | D | E | F | G | H>;
19/** @deprecated use {@link scheduled} and {@link concatAll} (e.g. `scheduled([[a, b, c], source], scheduler).pipe(concatAll())`) */
20export function startWith<T, D, E, F, G, H, I>(v1: D, v2: E, v3: F, v4: G, v5: H, v6: I, scheduler: SchedulerLike): OperatorFunction<T, T | D | E | F | G | H | I>;
21
22export function startWith<T, D>(v1: D): OperatorFunction<T, T | D>;
23export function startWith<T, D, E>(v1: D, v2: E): OperatorFunction<T, T | D | E>;
24export function startWith<T, D, E, F>(v1: D, v2: E, v3: F): OperatorFunction<T, T | D | E | F>;
25export function startWith<T, D, E, F, G>(v1: D, v2: E, v3: F, v4: G): OperatorFunction<T, T | D | E | F | G>;
26export function startWith<T, D, E, F, G, H>(v1: D, v2: E, v3: F, v4: G, v5: H): OperatorFunction<T, T | D | E | F | G | H>;
27export function startWith<T, D, E, F, G, H, I>(v1: D, v2: E, v3: F, v4: G, v5: H, v6: I): OperatorFunction<T, T | D | E | F | G | H | I>;
28export function startWith<T, D = T>(...array: D[]): OperatorFunction<T, T | D>;
29/** @deprecated use {@link scheduled} and {@link concatAll} (e.g. `scheduled([[a, b, c], source], scheduler).pipe(concatAll())`) */
30export function startWith<T, D = T>(...array: Array<D | SchedulerLike>): OperatorFunction<T, T | D>;
31/* tslint:enable:max-line-length */
32
33/**
34 * Returns an Observable that emits the items you specify as arguments before it begins to emit
35 * items emitted by the source Observable.
36 *
37 * <span class="informal">First emits its arguments in order, and then any
38 * emissions from the source.</span>
39 *
40 * ![](startWith.png)
41 *
42 * ## Examples
43 *
44 * Start the chain of emissions with `"first"`, `"second"`
45 *
46 * ```ts
47 * import { of } from 'rxjs';
48 * import { startWith } from 'rxjs/operators';
49 *
50 * of("from source")
51 * .pipe(startWith("first", "second"))
52 * .subscribe(x => console.log(x));
53 *
54 * // results:
55 * // "first"
56 * // "second"
57 * // "from source"
58 * ```
59 *
60 * @param {...T} values - Items you want the modified Observable to emit first.
61 * @param {SchedulerLike} [scheduler] - A {@link SchedulerLike} to use for scheduling
62 * the emissions of the `next` notifications.
63 * @return {Observable} An Observable that emits the items in the specified Iterable and then emits the items
64 * emitted by the source Observable.
65 * @method startWith
66 * @owner Observable
67 */
68export function startWith<T, D>(...array: Array<T | SchedulerLike>): OperatorFunction<T, T | D> {
69 const scheduler = array[array.length - 1] as SchedulerLike;
70 if (isScheduler(scheduler)) {
71 // deprecated path
72 array.pop();
73 return (source: Observable<T>) => concat(array as T[], source, scheduler);
74 } else {
75 return (source: Observable<T>) => concat(array as T[], source);
76 }
77}
Note: See TracBrowser for help on using the repository browser.