Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4828

Is it required to wrap non-Ember Promises (or Rx.Observables, or any async operations) in Ember Promises

$
0
0

@jameslaneconkling wrote:

I'm working on an app that relies heavily on a non-Ember library, Falcor to handle API calls. Is it required that all Falcor calls be wrapped in Ember Promises? E.g. if I'm doing something like

falcor.get(falcorPath)
  .subscribe(onNext, onError, onComplete);

do I always need to wrap this in an Ember promise, like so:

new Ember.RSVP.Promise((resolve, reject) =>
  falcor.get(falcorPath)
    .subscribe(res => {
      // handle onNext
    }, err => {
      // handle error
      resolve();
    }, () => {
      // handle finally callback
      reject();
    });

If the Ember Promise is required (seem to remember it makes tests aware of async behavior...?), then wondering if there might be any patterns to make Ember aware of Rx.Observables w/o the wrapping boilerplate.

Thanks for the help.

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles