source: trip-planner-front/node_modules/rxjs/src/internal/observable/of.ts@ 1ad8e64

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

initial commit

  • Property mode set to 100644
File size: 4.8 KB
Line 
1import { SchedulerLike } from '../types';
2import { isScheduler } from '../util/isScheduler';
3import { fromArray } from './fromArray';
4import { Observable } from '../Observable';
5import { scheduleArray } from '../scheduled/scheduleArray';
6
7/* tslint:disable:max-line-length */
8/** @deprecated use {@link scheduled} instead `scheduled([a, b, c], scheduler)` */
9export function of<T>(a: T, scheduler: SchedulerLike): Observable<T>;
10/** @deprecated use {@link scheduled} instead `scheduled([a, b, c], scheduler)` */
11export function of<T, T2>(a: T, b: T2, scheduler: SchedulerLike): Observable<T | T2>;
12/** @deprecated use {@link scheduled} instead `scheduled([a, b, c], scheduler)` */
13export function of<T, T2, T3>(a: T, b: T2, c: T3, scheduler: SchedulerLike): Observable<T | T2 | T3>;
14/** @deprecated use {@link scheduled} instead `scheduled([a, b, c], scheduler)` */
15export function of<T, T2, T3, T4>(a: T, b: T2, c: T3, d: T4, scheduler: SchedulerLike): Observable<T | T2 | T3 | T4>;
16/** @deprecated use {@link scheduled} instead `scheduled([a, b, c], scheduler)` */
17export function of<T, T2, T3, T4, T5>(a: T, b: T2, c: T3, d: T4, e: T5, scheduler: SchedulerLike): Observable<T | T2 | T3 | T4 | T5>;
18/** @deprecated use {@link scheduled} instead `scheduled([a, b, c], scheduler)` */
19export function of<T, T2, T3, T4, T5, T6>(a: T, b: T2, c: T3, d: T4, e: T5, f: T6, scheduler: SchedulerLike): Observable<T | T2 | T3 | T4 | T5 | T6>;
20/** @deprecated use {@link scheduled} instead `scheduled([a, b, c], scheduler)` */
21export function of<T, T2, T3, T4, T5, T6, T7>(a: T, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7, scheduler: SchedulerLike):
22 Observable<T | T2 | T3 | T4 | T5 | T6 | T7>;
23/** @deprecated use {@link scheduled} instead `scheduled([a, b, c], scheduler)` */
24export function of<T, T2, T3, T4, T5, T6, T7, T8>(a: T, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7, h: T8, scheduler: SchedulerLike):
25 Observable<T | T2 | T3 | T4 | T5 | T6 | T7 | T8>;
26/** @deprecated use {@link scheduled} instead `scheduled([a, b, c], scheduler)` */
27export function of<T, T2, T3, T4, T5, T6, T7, T8, T9>(a: T, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7, h: T8, i: T9, scheduler: SchedulerLike):
28 Observable<T | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9>;
29export function of<T>(...args: (T | SchedulerLike)[]): Observable<T>;
30
31// TODO(benlesh): Update the typings for this when we can switch to TS 3.x
32export function of<T>(a: T): Observable<T>;
33export function of<T, T2>(a: T, b: T2): Observable<T | T2>;
34export function of<T, T2, T3>(a: T, b: T2, c: T3): Observable<T | T2 | T3>;
35export function of<T, T2, T3, T4>(a: T, b: T2, c: T3, d: T4): Observable<T | T2 | T3 | T4>;
36export function of<T, T2, T3, T4, T5>(a: T, b: T2, c: T3, d: T4, e: T5): Observable<T | T2 | T3 | T4 | T5>;
37export function of<T, T2, T3, T4, T5, T6>(a: T, b: T2, c: T3, d: T4, e: T5, f: T6): Observable<T | T2 | T3 | T4 | T5 | T6>;
38export function of<T, T2, T3, T4, T5, T6, T7>(a: T, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7):
39 Observable<T | T2 | T3 | T4 | T5 | T6 | T7>;
40export function of<T, T2, T3, T4, T5, T6, T7, T8>(a: T, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7, h: T8):
41 Observable<T | T2 | T3 | T4 | T5 | T6 | T7 | T8>;
42export function of<T, T2, T3, T4, T5, T6, T7, T8, T9>(a: T, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7, h: T8, i: T9):
43 Observable<T | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9>;
44export function of<T>(...args: T[]): Observable<T>;
45/* tslint:enable:max-line-length */
46
47/**
48 * Converts the arguments to an observable sequence.
49 *
50 * <span class="informal">Each argument becomes a `next` notification.</span>
51 *
52 * ![](of.png)
53 *
54 * Unlike {@link from}, it does not do any flattening and emits each argument in whole
55 * as a separate `next` notification.
56 *
57 * ## Examples
58 *
59 * Emit the values `10, 20, 30`
60 *
61 * ```ts
62 * import { of } from 'rxjs';
63 *
64 * of(10, 20, 30)
65 * .subscribe(
66 * next => console.log('next:', next),
67 * err => console.log('error:', err),
68 * () => console.log('the end'),
69 * );
70 * // result:
71 * // 'next: 10'
72 * // 'next: 20'
73 * // 'next: 30'
74 *
75 * ```
76 *
77 * Emit the array `[1,2,3]`
78 *
79 * ```ts
80 * import { of } from 'rxjs';
81 *
82 * of([1,2,3])
83 * .subscribe(
84 * next => console.log('next:', next),
85 * err => console.log('error:', err),
86 * () => console.log('the end'),
87 * );
88 * // result:
89 * // 'next: [1,2,3]'
90 * ```
91 *
92 * @see {@link from}
93 * @see {@link range}
94 *
95 * @param {...T} values A comma separated list of arguments you want to be emitted
96 * @return {Observable} An Observable that emits the arguments
97 * described above and then completes.
98 * @method of
99 * @owner Observable
100 */
101
102export function of<T>(...args: Array<T | SchedulerLike>): Observable<T> {
103 let scheduler = args[args.length - 1] as SchedulerLike;
104 if (isScheduler(scheduler)) {
105 args.pop();
106 return scheduleArray(args as T[], scheduler);
107 } else {
108 return fromArray(args as T[]);
109 }
110}
Note: See TracBrowser for help on using the repository browser.