As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [promise]

"Promises" are a particular tactic for deferred computing, suitable for several styles of concurrency: thread and event loop concurrency for local computation, and both synchronous and asynchronous remote messaging.

Filter by
Sorted by
Tagged with
5 votes
1 answer
691 views

Angular promise in service

I'm new with Angular promise and I would like to know how to improve my code. I have a service which preload media or data by calling an API. The media API return an array of urls to preload. ...
Tib's user avatar
  • 153
2 votes
1 answer
266 views

Thoughts on this conversion of code from Step.js to Q promise library?

I have some code that I'd written using this pattern with Step.js. In this case, talking to MongoDB in Node: ...
HostileFork says dont trust SE's user avatar
6 votes
1 answer
260 views

Structuring functions receiving and returning promises?

I keep running into the same pattern with code using promises in javascript. When writing a function which takes a promise and returns a promise, obviously I want to reject the promise I'm returning ...
warp's user avatar
  • 163
4 votes
2 answers
208 views

Refactoring asynchronous JS pre-rendering code

A few months ago I wrote this module but, coming back to it, I find it a bit hard to read and reason about. I want to ask community's opinion on whether this needs to be refactored, and how I could ...
Dan's user avatar
  • 1,476
3 votes
1 answer
1k views

Limiting Q promise concurrency in JavaScript

I wrote a helper to limit Q promise concurrency. If I have a promise-returning function promiseSomething, writing ...
Dan's user avatar
  • 1,476
2 votes
1 answer
94 views

My yld NPM - callbacks/promises alternative

I'd like feedback on my callbacks/promises alternative, please. The yld repository ...
Lcf.vs's user avatar
  • 121
1 vote
2 answers
337 views

Can this promise be chained more cleanly?

The below code uses Promises/A+ (specifically rsvp.js) to generate a token. It does so by either taking an existing token or downloading and parsing a token from a web page. Is it possible to chain ...
Brian's user avatar
  • 548
2 votes
1 answer
407 views

Improving a JQuery Promise "Chain"

I have a little chain of JQuery promises. My problem is at each stage I want to notify my progress to the user, keep them in the loop (Perhaps using .notify somehow?) What I've eneded up with is ...
JonWells's user avatar
  • 323
2 votes
2 answers
2k views

jQuery nested ajax deffereds- looking for improvements

Following is a working solution for a single xml ajax to retrieve category list, then individual ajax calls for each category. This was developed in response to a question on SO. Solution creates one ...
charlietfl's user avatar
1 vote
1 answer
360 views

Simple jQuery search on input element

Just wanted a way of attaching a jQuery search plugin to an input element (or collection) and be able to pass specific options at invoke time: This is the plugin code ...
MartyJ's user avatar
  • 11
6 votes
1 answer
5k views

Multiple jQuery promises

I'm starting to reuse this pattern, and was wondering if there was a more succinct/clear way to write it. Given a function foo taking a callback argument: ...
Gijs's user avatar
  • 161

1 2 3 4 5
6