getting rxjs errors when referencing latest rxjs
Update 2018/12:
RxJS v6.x introduced a new, more "functional" API. Take a look at the 5>6 migration guide for more info. The original example code still works, but you'll have to import the of
operator like so:
// ESM
import { of } from 'rxjs'
// CJS
const { of } = require('rxjs');
Original RxJS 5 answer:
That's right. RxJS 5 was rewritten to improve performance and also conform to the ES7 Observable
spec. Check out the RxJS 4->5 migration page on Github.
Here's a working example:
// Create new observable
const one = Observable.of(1,2,3);
// Subscribe to it
const oneSubscription = one.subscribe({
next: x => console.log(x),
error: e => console.error(e),
complete: () => console.log('complete')
});
// "Dispose"/unsubscribe from it
oneSubscription.unsubscribe();
A lot of methods got renamed, but the API itself is very easy to transition to.