Skip to content

Proposal: RxJava 2 - style Observer interface #70

@benlesh

Description

@benlesh

As discussed in the ES7 Observable Spec here, the idea looks like this:

interface Observer {
  subscribed((subscription: Subscription) => void): void
  next((value: any) => void): void
  error((err: any) => void): void
  complete(() => void): void
}

Advantages:

  1. Actually knowing when a subscription starts (for things like subscribeOn)
  2. Sets us up for backpressure handling later on.
  3. Becomes trivial for end-user developer to add this.sub = subscription in the subscribed handler, giving a reference to subscription in all other handlers without closure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions