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
1 answer

Correct way to join promises together

Currently I am doing this which is awful: //start the initial request request({ ... }).then(function(response1) { //Start a second request once the first has finished as it is dependent on the…
jax
  • 37,735
  • 57
  • 182
  • 278
1
vote
1 answer

Ember & RSVP: How to resolve nested relations in route's model function?

Having problems to understand how to resolve nested models in ember. Damn. I don't know if it's a common approach but I don't want my controllers or components care about asynchronicity at all. Therefore it's necessary to resolve everything needed…
Doe Johnson
  • 1,374
  • 13
  • 34
1
vote
1 answer

Porting RSVP.js map idiom over to bluebird

In RSVP.js, there is a very elegant idiom: var promises = [2, 3, 5, 7, 11, 13].map(function(id){ return getJSON("/post/" + id + ".json"); }); RSVP.all(promises).then(function(posts) { // posts contains an array of results for the given…
matanster
  • 15,072
  • 19
  • 88
  • 167
1
vote
1 answer

Promises.all does not hit catch() block when one promise fails?

I'm trying to run a function when two compilation steps are complete, but the success callback keeps getting called even one fails. Here's the code: function compile(tplStr) { return new Promise(function(resolve,reject) { // compile template…
mpen
  • 272,448
  • 266
  • 850
  • 1,236
1
vote
1 answer

Proper way of chaining RSVP promises

So I have a function data.people() which sends and http request and receives data, therefore I am using promises and this function returns a promise. After that I use the folowing chaining data.people() .then(function() { .... }, function(err)…
Boyan Hristov
  • 1,067
  • 3
  • 15
  • 41
1
vote
1 answer

Context in EmberJS RSVP onerror handler

I am implementing error logging in my EmberJS application much as is described here and it's working pretty well. The only part that is throwing me off is how to properly handle error calls from the Ember RSVP onerror event. Errors produced from…
Matt Baker
  • 3,394
  • 3
  • 25
  • 35
1
vote
2 answers

Wordpress rsvp/contact form pre-populated

I am very new to wordpress and would like to create a rsvp form with a difference. For the launch of a company we are having multiple events and i would like to track the rsvp for each event. Here is the scenario: I send out paper invites for my…
1
vote
1 answer

Returning a promise in JavaScript

I have a promise here: myPromise: -> return new Em.RSVP.Promise (resolve, reject) -> # ... resolve 5 How do I write a function to return the promise from myPromise()? This is what I've tried: myPromise2: -> return…
nnyby
  • 4,748
  • 10
  • 49
  • 105
0
votes
2 answers

RSVP hash using vanilla promises

RSVP lib has a hash of promises helper that allows to "retrieve" promises references: var promises = { posts: getJSON("/posts.json"), users: getJSON("/users.json") }; RSVP.hash(promises).then(function(results) { console.log(results.users) //…
rap-2-h
  • 30,204
  • 37
  • 167
  • 263
0
votes
1 answer

RSVP Promises: Why does parent promise wait on non-chained inner promise?

We're using an older version of RSVP.js in several apps we built. I expected this promise to resolve immediately while outputting "1", "2", and after 5 seconds "3". I thought the inner promise would be treated like a value. new…
nogridbag
  • 3,521
  • 4
  • 38
  • 51
0
votes
1 answer

Why RSVP Deferred produces error when promise is called twice

Why RSVP Deferred produces an error when the promise is called twice? It seems that there is a difference between deferred.promise.then().finally() and deferred.promise.then(); deferred.promise.finally(). Why? RSVP.on('error', function(reason) { …
Charles
  • 11,367
  • 10
  • 77
  • 114
0
votes
1 answer

Ember/RSVP Promise value changes when passed to resolve()

I am trying to wrap a jQuery AJAX request in a Ember RSVP promise, and I have this issue where the value I send to the resolve function (which is the jqXHR parameter) changes from object to string. The code for doing the request + creating the…
blue
  • 125
  • 10
0
votes
1 answer

Returning a result from a function after a promise resolves

So I have to pass a simple boolean to a library. In order to get the value to return I have to evaluate the resolution of a promise(it makes a asynchronous call). So I have something like this: import {funcThatReturnsPromise} from…
TheMethod
  • 2,893
  • 9
  • 41
  • 72
0
votes
1 answer

Looping through an Ember JS RSVP hash?

Code speaks a thousand words; is there a way to do what I'm attempting here? Users "Root" Route Loading common selectable options at the top level for use within sub-routes such as index, show, edit, create, etc... -- /pods/users/route.js model()…
SamSebastien
  • 181
  • 1
  • 3
  • 9
0
votes
1 answer

GeoFire structure doesn't match documentation

GeoFire is saving data using an undocumented structure. How can I get it to save like the official examples. I haven't followed any particular tutorial or guide, but I've based my work heavily on these examples. I've been able to replicate the…
JohnParkerG
  • 65
  • 1
  • 10