create
signature: create(subscribe: function)
create(subscribe: function)주어진 subscription 함수로 옵저버블을 생성.
예시
// RxJS v6+
import { Observable } from 'rxjs';
/*
subscription에서 'Hello' 와 'World'를 내보내는 옵저버블을 생성
*/
const hello = Observable.create(function(observer) {
observer.next('Hello');
observer.next('World');
observer.complete();
});
//결과: 'Hello'...'World'
const subscribe = hello.subscribe(val => console.log(val));추가 자료
Last updated
Was this helpful?