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
90
votes
9 answers

How can I execute array of promises in sequential order?

I have an array of promises that need to run in sequential order. var promises = [promise1, promise2, ..., promiseN]; Calling RSVP.all will execute them in parallel: RSVP.all(promises).then(...); But, how can I run them in sequence? I can…
jaaksarv
  • 1,440
  • 1
  • 11
  • 16
76
votes
6 answers

EmberJS: How to load multiple models on the same route?

While I am not new to web development, I am quite new to to client-side MVC frameworks. I did some research and decided to give it a go with EmberJS. I went through the TodoMVC guide and it made sense to me... I have setup a very basic app; index…
Eric
  • 1,020
  • 1
  • 12
  • 18
19
votes
1 answer

How are Ember's Promises related to Promises in general, and specifically jQuery's Promises?

Some big-picture questions to help learning about Ember's Promise: Is Ember's RSVP the same as Tildeio's RSVP? If not, how are they different? How are they related? Does JavaScript "Promise" come in different flavors, i.e. specifications? If it…
HaoQi Li
  • 11,970
  • 14
  • 58
  • 77
11
votes
1 answer

How to use ic-ajax with jsonp?

In a controller: /*globals Ember*/ import { raw as icAjaxRaw } from 'ic-ajax'; ... myData: function() { var promise = new Ember.RSVP.Promise(function (resolve, reject) { var req = icAjaxRaw({ type: 'GET', …
bguiz
  • 27,371
  • 47
  • 154
  • 243
9
votes
1 answer

Trying to understand Ember JS promises

I have been trying to work on a code example to get my head around promises. But I can't seem to figure out how to deal with the callbacks and get the "thenable" value later. Here are two relevant JSBin examples I am working on. Written in verbose…
Gordon Potter
  • 5,802
  • 9
  • 42
  • 60
7
votes
1 answer

How to read multiple files asynchronously with promises, then proceed

I'm new to promises and using the rsvp implementation. I want to asynchronously read a list of files, then proceed to another task only when all files have been read. I've got as far as the basic structure to read one file, and chain to the next…
mtmacdonald
  • 14,216
  • 19
  • 63
  • 99
7
votes
2 answers

How to use Ember.RSVP.onerror to report exceptions from rejected promises without error handlers

I just watched this video of a recent panel discussion with the ember-core framework developers. In the video the panel members are eached asked to share one general debugging tip -- Tom Dale calls out the RSVP onerror handler which makes it…
Ben
  • 977
  • 2
  • 11
  • 21
6
votes
1 answer

How rsvp.js handles rejected promise with chain of failure callbacks

Re: https://github.com/tildeio/rsvp.js I have a function called doSomething() that does something for a little while and then returns an RSVP.Promise. Then, a chain of success and failure callbacks are registered with the returned promise (see code…
RBR
  • 999
  • 3
  • 13
  • 24
5
votes
1 answer

Are Promise.resolve and new Promise(resolve) interchangeable

I think Promise.resolve and new Promise(resolve) are interchangeable. Consider this: A. new RSVP.Promise(function (resolve, reject) { resolve(); }).then(function () { return new RSVP.Promise(function (resolve) { resolve("HI") …
CSnerd
  • 2,129
  • 8
  • 22
  • 45
5
votes
2 answers

Calling an Ember _super method from Promise handler

I'm trying to make use of _super in the handler of a Promise inside of a Controller action, but it doesn't work because it seems to lose the correct chain of functions. ApplicationRoute = Ember.Route.extend SimpleAuth.ApplicationRouteMixin, …
neverfox
  • 6,680
  • 7
  • 31
  • 40
5
votes
1 answer

Accessing the controller from a route's beforeModel

I would like to access my route's controller from within the beforeSend hook on a route to take advantage of the pause on promise logic. This is my current workaround to be able to set "category_config" on my controller which is obtained from a…
Joel T
  • 237
  • 2
  • 9
4
votes
2 answers

Confused when make a promise from setTimeout

I am new to Promise. I wrote two examples: The first one is: new RSVP.Promise(function (resolve, reject) { setTimeout(function () { resolve("HI") }, 3000); }).then(function (result) { console.log(result); }); This one will print…
CSnerd
  • 2,129
  • 8
  • 22
  • 45
4
votes
2 answers

How to register a custom callback after Ember.RSVP.hash

I have a route that pulls in 2 different promises using RSVP like so model: function() { return Ember.RSVP.hash(function() { stuff: App.Thing.find(), other: this.store.find('appointments', {day: day}) }); } The challenge is that I…
Toran Billups
  • 27,111
  • 40
  • 155
  • 268
4
votes
2 answers

Chaining multiple ajax requests with promises

I'm looking to chain multiple ajax requests, something along the lines of: get first JSON, if successful move on and get second JSON, if successful make a new object consisting of both JSON data. // get first…
cat-t
  • 1,346
  • 1
  • 18
  • 34
4
votes
2 answers

RSVP - Handling timeouts with promises

I am using ember.js and RSVP. From what I can see, there is nothing that handles a timeout from an async call. My thinking is to wrap the resolve handler using the decorator pattern to wrap the resolve handler in some code that will time the call…
dagda1
  • 26,856
  • 59
  • 237
  • 450
1
2 3 4 5 6 7