Skip to content

Consistency with RxJS (and interop) #45

Open
@jayphelps

Description

@jayphelps

What are your thoughts on Flowable's API compared to the latest RxJS? (v6 as of this writing, v4 API used to be very similar to Flowable)

The biggest differences off hand:

  • RxJS uses pipeable operators e.g. source.pipe(take(1)) instead of prototype methods like Flowable (and old versions of RxJS). See here why.
  • RxJS uses next() error() complete() instead of onNext() onError() onComplete(). This was changed a while ago because Observable was (technically still is) being proposed as an addition to the TC39 ECMAScript standard and that's what they wanted. Even though the standard is effectively dead at the moment, the rename ship has long since sailed. RxJS also supports a shorthand overload .subscribe(nextFn, errorFn, completeFn) passing them as arguments instead of passing an object with those names--Flowable supports just .subscribe(nextFn) overload.

Biggest reason I'm bringing up is I would imagine a dev using Flowable would also use RxJS, and having things consistent makes for a better DX.

Having a toObservable() method would also be handy for cases where you don't want to handle backpressure, but alternatively (or in addition) RxJS could support consuming Flowable via import { from } from 'rxjs'; from(flowable).subscribe(...)

I imagine this has been discussed internally, but couldn't find anything publicly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions