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
1
vote
0 answers

How to signal the caller about the state of a promise

I have Ember code where the backend API calls are abstracted into a separate service. This service uses ember-ajax library for making backend calls. This service sets up the common headers, handles the timeout errors, and 4xx/5xx errors. And…
Robin Bajaj
  • 2,002
  • 4
  • 29
  • 47
1
vote
3 answers

JSHint, For Loops, Promises and one pesky lint error

I have a situation in my JavaScript where I'm generating a number of promises which I want to attach then/catch conditions on to each one to deal with the individual issues. I'm using the RSVP Promise library which lets me use allSettled to…
Matt Scheurich
  • 959
  • 2
  • 12
  • 24
1
vote
3 answers

Waiting for the response of several promises in EmberJS

I'm trying to make 3 API calls and then return an array of all the data. However, the console.log() (and therefore the function return) is empty as it's not waiting for the AJAX call to be resolved - but I can't do it in the loop as I need all the…
Joe Czucha
  • 4,123
  • 2
  • 20
  • 28
1
vote
1 answer

Unable to test rsvp promises in jest

I'm stuck with writing unit tests for my code that uses rsvp promises. I tried to use pit tests but had no luck in making tests pass for rsvp, however embedded promises work just fine: //jest.autoMockOff(); - even with this rsvp test is…
Alex
  • 2,916
  • 3
  • 22
  • 27
1
vote
1 answer

Why is my JavaScript Promises using the RSVP.js library returning an error after all my Promises succeeded?

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. After that it runs a non ajax function…
JasonDavis
  • 48,204
  • 100
  • 318
  • 537
1
vote
1 answer

JavaScript Promise Library to load JSON data with AJAX request on first call and then load from cached variables on duplicate calls

Quick Description of what my JS app should do... I am using the JavaScript Promise library RSVP.js - https://github.com/tildeio/rsvp.js/ in my project. Some things the code does... Load 4-5 JOSN URLs using AJAX on 1st request and all followup…
JasonDavis
  • 48,204
  • 100
  • 318
  • 537
1
vote
1 answer

Promise chain continues before inner promise is resolved

Similar question to Promise resolve before inner promise resolved but I can't get it to work nontheless. Every time I think I understand promises, I prove myself wrong! I have functions that are written like this function getFileBinaryData () { …
Daniel B
  • 8,770
  • 5
  • 43
  • 76
1
vote
1 answer

javascript promises return

I have a function func which resolves a promise and then tries to return the updated value of a local variable returnval func: function(){ returnval = false; var promise = new Ember.RSVP.Promise(function(resolve) { // some stuff .. …
Ninja420
  • 3,542
  • 3
  • 22
  • 34
1
vote
1 answer

Why is the chained callback for success promises executed on both success and failure?

So I have a base function that saves an Ember Data model, and runs common callback code on failure then returns the promise to the caller, so the caller can chain other callbacks on its own, but somehow, the chained callbacks from the caller are not…
Abdulaziz
  • 2,201
  • 1
  • 21
  • 35
1
vote
1 answer

RxJava Observable continue on error and get status

In RxJava (or RX in general), is there any way to combine observables in a way that the resulting observable waits until every observables are finished in either way (does not freak out when any of them throws error) and then complete with a single…
Michal Boska
  • 1,041
  • 1
  • 8
  • 26
1
vote
1 answer

How do I use RSVP deferreds with WebSocket?

I need to open multiple WebSocket connections concurrently and then perform actions once all the connections are opened. I am using the defer(), all(), and then() methods of RSVP.js. However, neither the then() nor the catch() is being triggered,…
Derek Henderson
  • 9,388
  • 4
  • 42
  • 71
1
vote
4 answers

How to convert nested setTimeouts to promises

Using rsvp.js or any other promises/A+ implementation how can I turn code like... console.log('step 1'); setTimeout(function() { console.log('step 2'); setTimeout(function() { console.log('step 3'); }, 100); }, 300); into a promises…
Wilfred
  • 799
  • 2
  • 16
  • 26
1
vote
0 answers

jQuery promises and deferreds vs rsvp.js

I have been trying to understand the concept of promises implemention by jQuery and deferreds. I also started reading about rsvp.js, which says they are promises/A+ compliant whereas jQuery promises are not. Can someone guide me to a book / online…
VishnuNair
  • 121
  • 4
  • 12
1
vote
1 answer

Catching a Promise exception and returning a default value

I am having an issue where I want to return a default value if an exception occurs on a promise. The array I return does not seem to work properly. My Route model hook model: function() { return { menuItems :…
jax
  • 37,735
  • 57
  • 182
  • 278
1
vote
1 answer

Ember.RSVP.all seems to resolve immediately

I'm really hoping that there's something dumb that I'm doing, but I can't seem to find it. I'm trying to use Ember.RSVP.all in the middle of a chain of promises. The example I have is much simpler than my use, but it demonstrates the issue. In the…
Carl
  • 905
  • 5
  • 9