Questions tagged [rsvp.js]

A lightweight library that provides tools for organizing asynchronous code

RSVP.js provides simple tools for organizing asynchronous code.

Specifically, it is a tiny implementation of Promises/A+ and a mixin for turning objects into event targets.

It works in node.js and the browser.

97 questions
4
votes
2 answers

How to execute Ember.RSVP.all within an ember run loop correctly

I'm trying to execute a promise inside Ember.RSVP.all App.Foo = Ember.Object.create({ bar: function() { var configuration = ajaxPromise("/api/configuration/", "GET"); Ember.RSVP.all([configuration]).then(function(response) { …
Toran Billups
  • 27,111
  • 40
  • 155
  • 268
4
votes
2 answers

acceptable promise pattern for 'LOUD' errors?

I'm using the RSVP library distributed inside Ember.js and I'm trying to figure out the correct pattern for reporting fatal errors inside a promise -- particularly I want to inform of something that's almost certainly the result of a programming…
Ben
  • 977
  • 2
  • 11
  • 21
3
votes
2 answers

Use of Promises for sequential processing

I'm relatively new to Node.js and JavaScript -please excuse if the question below is dumb. To me, promises for async processing make sense but I'm not 100% sure about the use of promises when it comes to serial/sequential processing. Lets look at…
MojoJojo
  • 3,897
  • 4
  • 28
  • 54
3
votes
2 answers

Run multiple JavaScript Promises with RSVP.js Promise Library

The simple demo JavaScript code below uses the RSVP.js Promise Library https://github.com/tildeio/rsvp.js/ to load some JSON data using AJAX and on completion fires off some code after all JSON data has loaded. I am wanting to expand it to do some…
JasonDavis
  • 48,204
  • 100
  • 318
  • 537
3
votes
1 answer

How to run qunit assertions on resolving a Promise

I am writing a test for a function that returns a promise, and am not able to run assertions on resolving or rejecting the promise. I cannot use ES6 on this project so I am using the rsvp.js library which claims to implement the Promises/A+…
carbontax
  • 2,164
  • 23
  • 37
3
votes
1 answer

How can I test if a function is returning a promise in Ember?

In Ember, I sometimes run into the situation where I need to check if a function is returning a promise. For example, if I have a route that is derived: MyRoute = ParentRoute.extend({ beforeModel: function() { this._super().then(function() { …
Kevin Bullaughey
  • 2,556
  • 25
  • 37
3
votes
1 answer

Why isn't this rejected RSVP promise not calling catch()?

In my Ember RSVP code, I'm not able to get any error handlers called, even though I see that my 'reject' function is executing successfully. Code: var promise = new Promise(function(resolve, reject) { doStuff().then(function() { …
J B
  • 390
  • 1
  • 4
  • 16
3
votes
1 answer

How do I return the boolean value from this layer-cake of promises?

I've got a controller method that takes a string argument so I can test if a user has a capability. The user has many roles and the roles has an array of permissions attached that we need to check if it contains the capability. I know this is overly…
ToddSmithSalter
  • 715
  • 6
  • 20
3
votes
1 answer

How to call "apply" in a promise-based setup in Javascript to pass parameters to the next then()?

I'm writing a promise-based method which takes one parameter and returns an array of values in the next step. Something like this: foo(a).then(function (arr) {}); Inside my method foo I'm doing something like this: foo = function (a) { ... //…
frequent
  • 27,643
  • 59
  • 181
  • 333
3
votes
1 answer

Why do JS Promise A+ create/fulfill/reject not part of the spec?

http://promisesaplus.com/ Finally, the core Promises/A+ specification does not deal with how to create, fulfill, or reject promises, choosing instead to focus on providing an interoperable then method. Future work in companion specifications…
Sebastien Lorber
  • 89,644
  • 67
  • 288
  • 419
3
votes
1 answer

Ember JS: How to load a second model based on data from a first

I have an Ember app that, rather than using Ember Data, uses our own custom AJAX data layer to talk to an API. We're able to load two models at once using RSVP - one is a Project object via our API wrapper, the second is an object representing the…
JamesG
  • 1,687
  • 2
  • 25
  • 39
3
votes
2 answers

Integrating array of promises from RSVP.js with jQuery's $.ajax

Re: https://github.com/tildeio/rsvp.js What's the best way to integrate RSVP.js with jQuery's $.ajax? After doing some reading and research, I see that in Ember there is active development of a wrapper around it...…
Stan Dyro
  • 33
  • 3
2
votes
2 answers

Ember.js: Load related multiple models

Since the ember-guides explains how to load mutliple models on a route like that export default Ember.Route.extend({ model() { return Ember.RSVP.hash({ songs: this.get('store').findAll('song'), albums:…
EchtFettigerKeks
  • 1,692
  • 1
  • 18
  • 33
2
votes
1 answer

Chaining promises with Ember.RSVP.all and Ember.RSVP.Promise returning odd results

When I do something like: Ember.$.getJSON(url) .then(function(response){ return Ember.RSVP.all(response.map(Ember.$.getJSON)) }) .then(function(response){ // this is where the oddity begins console.log(response) }) in the model…
tr3online
  • 1,429
  • 2
  • 24
  • 45
2
votes
1 answer

Ember.js - different promise classes

What is the difference between using: new RSVP.Promise() (docs) and new Promise() (docs) in an Ember app? Are they just aliases?
JDillon522
  • 19,046
  • 15
  • 47
  • 81