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
4 votes
2 answers

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 ...
1 vote
2 answers

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 ...
2 votes
2 answers

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 ...
6 votes
1 answer

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: ...
1 vote
1 answer

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 ...
2 votes
1 answer

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 ...

1 2 3 4 5