Skip to content

Latest commit

 

History

History
62 lines (42 loc) · 1.23 KB

of.md

File metadata and controls

62 lines (42 loc) · 1.23 KB

Of

Сигнатура

of<T>(...args: (SchedulerLike | T)[]): Observable<T>

Описание

Создает из аргументов Observable

Параметры

  • args

    Список аргументов

  • scheduler

    Тип планировщика. Передается последним параметром

Примеры

Пример 1: Список чисел

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'

Пример 2: Использование массива

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]'

Полезные ссылки