JavaScript > Promises
Contents
Resources, Blogs, and Books
For beginners
The why, what, and how. "A brief introduction [...] primarily aimed at frontend developers".
Chapter from You Don't Know JS: Async & Performance
An interactive nodeschool workshop
Deep Dive
@sindresorhus's notes, patterns, and solutions to common Promise problems
Promise behaviour demonstrated and explained by common questions and their answers.
Promise behaviour demonstrated and explained by common questions and their answers.
Promises/A+ Implementations (ES6/ES2015 compatible)
Implementations with extras
Fully featured, extremely performant. Long stack traces & generator/coroutine support.
Hyper performant & full featured like Bluebird, but FP-oriented. Coroutines, generators, promises, ES2015 iterables, & fantasy-land spec.
Lightweight with a few extras. Compatible down to IE6!
One of the original implementations. Long stack traces and other goodies.
Small with nodeify, denodify and done() additions.
Packed with control flow, functional, and utility methods.
Strict Implementations
Ponyfill. Node-oriented, but browserifyable. Extremely small implementation.
Polyfill. Browser and node-compatible.
Opt-in polyfill. A strict-spec subset of rsvp.js.
Small, browserifyable with an opt-in polyfill.
Convenience Utilities
Delay a promise a specified amount of time.
Promisify ("denodify") a callback-style function.
Make unhandled promise rejections fail loudly instead of the default silent fail.
Make unhandled promise rejections fail hard right away instead of the default silent fail
Promise queue with concurrency control
Break out of a promise chain
Create a lazy promise that defers execution until ".then()" or ".catch()" is called
Create a deferred promise
Conditional promise chains
Tap into a promise chain without affecting its value or state
Map over promises concurrently
Run promise-returning & async functions concurrently with optional limited concurrency
Run multiple promise-returning & async functions with limited concurrency
Run promise-returning & async functions a specific number of times concurrently
Conditional promise catch handler
Measure the time a promise takes to resolve
Log the value/error of a promise
Filter promises concurrently
Settle promises concurrently and get their fulfillment value or rejection reason
Memoize promise-returning & async functions
Calls a function repeatedly while a condition returns true and then resolves the promise
Throttle promise-returning & async functions
Debounce promise-returning & async functions
Retry a promise-returning or async function
Wait for a condition to be true
Timeout a promise after a specified amount of time
A better Promise.race()
Promise#try() ponyfill - Starts a promise chain
Promise#finally() ponyfill - Invoked when the promise is settled regardless of outcome
Wait for any promise to be fulfilled
Wait for a specified number of promises to be fulfilled
Compose promise-returning & async functions into a reusable pipeline
Iterate over promises serially
Map over promises serially
Reduce a list of values using promises into a promise for a value
Like Promise.all() but for Map and Object
Others
Standalone bluebird.method. Turn a synchronously-returning method into a promise-returning one.
Determine if something looks like a Promise.
Resolve when a stream ends. Optional buffering (be careful with this!)
Write async functions in a blocking style using promises and generators. Like bluebird.coroutine.
Like task.js and bluebird.coroutine, but supports thunks too.
Calls a function repeatedly until a condition returns true and then resolves the promise.
Calls a function repeatedly while a condition returns true and then resolves the promise.
Push a set of work to be done in a configurable serial fashion
Standalone nodeify method which calls a Node-style callback on resolution or rejection.