Skip to content

Files

Latest commit

0f67527 · Oct 22, 2015

History

History
30 lines (19 loc) · 777 Bytes

File metadata and controls

30 lines (19 loc) · 777 Bytes

Converts an existing observable sequence to an ES6 Compatible Promise.

Arguments

  1. promiseCtor (Function): The constructor of the promise. If not provided, it looks for it in Rx.config.Promise.

Returns

(Promise): An ES6 compatible promise with the last value from the observable sequence.

Example

var promise = Rx.Observable.return(42).toPromise(RSVP.Promise);

promise.then(console.log.bind(console));

// => 42

Example with config

Rx.config.Promise = RSVP.Promise;
var promise = Rx.Observable.return(42).toPromise();

promise.then(console.log.bind(console));

// => 42