of
signature: of(...values, scheduler: Scheduler): Observable
of(...values, scheduler: Scheduler): Observable주어진 인자를 옵저버블로 바꿉니다.
예시
// RxJS v6+
import { of } from 'rxjs';
//제공된 수를 순서대로 내보냅니다.
const source = of(1, 2, 3, 4, 5);
//결과: 1,2,3,4,5
const subscribe = source.subscribe(val => console.log(val));// RxJS v6+
import { of } from 'rxjs';
//어떠한 타입의 값이든 내보냅니다.
const source = of({ name: 'Brian' }, [1, 2, 3], function hello() {
return 'Hello';
});
//결과: {name: 'Brian'}, [1,2,3], function hello() { return 'Hello' }
const subscribe = source.subscribe(val => console.log(val));관련된 사용법
추가 자료
Last updated
Was this helpful?