operators
Create: of, interval .etc [ import { interval, Observable, of } from 'rxjs ]
import { interval, Observable, of } from 'rxjs';
const observable = new Observable(subscriber=>{
subscriber.next(1);
subscriber.next(2);
subscriber.next(3);
subscriber.complete();
});
const ob2 = of(1,2,3);
observable.subscribe(x=>{console.log("got src " + x);});
ob2.subscribe(x=>{console.log("got of " + x);});
const ob5 = interval(1000 );
ob5.subscribe(x=>{console.log("got interval " + x);});
Change: map, first .etc [ import { first, map } from ‘rxjs/operators’ ]
import { of } from 'rxjs';
import { first, map } from 'rxjs/operators';
const ob3 = map((x:number)=>x*x)(of(1,2,3));
ob3.subscribe(x=>{console.log("got map " + x);});
const ob4 = first()(of(1,2,3));
ob4.subscribe(x=>{console.log("got first " + x);});
参考
operators
API