Skip to content

Instantly share code, notes, and snippets.

@nootanghimire
Forked from joepie91/promises-reading-list.md
Created October 21, 2015 18:23
Show Gist options
  • Save nootanghimire/b8918194452905c6e6a9 to your computer and use it in GitHub Desktop.
Save nootanghimire/b8918194452905c6e6a9 to your computer and use it in GitHub Desktop.
Promises (Bluebird) reading list

Promises reading list

This is a list of examples and articles, in roughly the order you should follow them, to show and explain how promises work and why you should use them. I'll probably add more things to this list over time.

This list primarily focuses on Bluebird, but the basic functionality should also work in ES6 Promises, and some examples are included on how to replicate Bluebird functionality with ES6 promises. You should still use Bluebird where possible, though - they are faster, less error-prone, and have more utilities.

I'm available for tutoring and code review :)

You may reuse all gists for any purpose under the WTFPL / CC0 (whichever you prefer).

Compatibility

Bluebird will not work correctly in older browsers. If you need to support older browsers, and you're using Webpack or Browserify, you should use the es6-promise module instead, and reimplement behaviour where necessary.

Introduction

Error handling

Many examples on the internet don't show this, but you should always start a chain of promises with Promise.try, and always return your promises chain from a function or callback. Not doing so, will result in less reliable error handling and various other issues (eg. code executing too soon).

Promisifying

Functional (map, filter, reduce)

Nesting

ES6 Promises

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment