of<T>(...args: (SchedulerLike | T)[]): Observable<T>
Создает из аргументов Observable
-
args
Список аргументов
-
scheduler
Тип планировщика. Передается последним параметром
import { of } from 'rxjs';
of(10, 20, 30)
.subscribe(
next => console.log('next:', next),
err => console.log('error:', err),
() => console.log('the end'),
);
// result:
// 'next: 10'
// 'next: 20'
// 'next: 30'
import { of } from 'rxjs';
of([1,2,3])
.subscribe(
next => console.log('next:', next),
err => console.log('error:', err),
() => console.log('the end'),
);
// result:
// 'next: [1,2,3]'
- 📰 Официальная документация: of
- 📁 Исходный код: https://github.com/ReactiveX/rxjs/blob/6.5.4/src/internal/observable/of.ts