observable documentation code example
Example 1: understanding Observable.create(
import { Observable } from "rxjs/Observable";
var observable = Observable.create(function subscribe(observer) {
observer.next('Hey guys!')
})
var observable = Observable.create((observer:any) => {
observer.next('Hey guys!')
})
Example 2: observable js
content_copy
open_in_new
import { Observable } from 'rxjs'; const foo = new Observable(subscriber => { console.log('Hello'); subscriber.next(42); subscriber.next(100); subscriber.next(200); setTimeout(() => { subscriber.next(300);