Rx.Observable.just is not a function in JSBIN & RxJS 5
Asked Answered
W

2

21

In JsBin, I got error "Rx.Observable.just is not a function" in Firefox & Chrome. JsBin example : http://jsbin.com/vunuta/edit?html,js,console

HTML :

script src="https://npmcdn.com/@reactivex/[email protected]/dist/global/Rx.umd.js">

Typescript :

Rx.Observable.from ([1,2,3]).subscribe(x => console.log(x)); // Work
Rx.Observable.just (99).subscribe(x => console.log(x)); // Fail
Rx.Observable.return (99).subscribe(x => console.log(x)); // Fail

Tx

Winnipegosis answered 26/8, 2016 at 14:46 Comment(1)
I found why. just & return are replace by operator of github.com/ReactiveX/rxjs/blob/master/MIGRATION.mdWinnipegosis
E
37

Rx.Observable.just() is no longer provided in v5. Use Rx.Observable.of(). https://github.com/ReactiveX/rxjs/blob/master/MIGRATION.md

Eraeradiate answered 10/9, 2016 at 14:27 Comment(0)
H
5

Update for rxjs v6

Yes, use of instead of just. The import and usage of of changed between rxjs v5 and rxjs v6.

For rxjs v6, use of as in the following example code:

import { of } from "rxjs";

let source$ = fromPromise(getPostById(1)).pipe(
  flatMap(post => {
    return hydrateAuthor(post);
  }),
  catchError(error => of(`Caught error: ${error}`))
);
Huehuebner answered 5/5, 2019 at 11:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.