Sha256: ccb488423f232d88ef4618f9acda46656124ac814772bff683efcbbe67ffcaff
Contents?: true
Size: 594 Bytes
Versions: 14
Compression:
Stored size: 594 Bytes
Contents
/** * Converts a Promise to an Observable sequence * @param {Promise} An ES6 Compliant promise. * @returns {Observable} An Observable sequence which wraps the existing promise success and failure. */ var observableFromPromise = Observable.fromPromise = function (promise) { return observableDefer(function () { var subject = new Rx.AsyncSubject(); promise.then( function (value) { subject.onNext(value); subject.onCompleted(); }, subject.onError.bind(subject)); return subject; }); };
Version data entries
14 entries across 7 versions & 1 rubygems