Skip to content

Proposol: API Additions #23

@stefanpenner

Description

@stefanpenner

promise.catch

When the catch method is called with argument onRejected the following steps are taken:

  1. Let promise be the this value.
  2. Return Invoke(promise, "then", (undefined, onRejected)).

promise.finally

not part of the spec yet, was postponed to ES7.

It is useful for ensuring a callback is run regardless of the promise it chains's fate. Also it's returned promise is fated to the promise it was chained from and as such as no ability to effect downstream outcomes.

In practice this is useful for ensuring cleanup regardless of outcome.

RXPromise *promise = [RXPromise resolveWith: 1]

promise.finally(^{
  // void, no possible way to effect downstream fate
}).then(^((int) value){
 // value == 1
}, nil)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions