Awesome Promises
发布于 9 年前 作者 i5ting 3645 次浏览 最后一次编辑是 8 年前 来自 分享

原文 https://github.com/wbinnssmith/awesome-promises

整理了一些关于promise相关的文档

<a href=“http://promisesaplus.com/”> <img src=“http://promisesaplus.com/assets/logo-small.png” alt=“Promises/A+ logo” align=“right” /> </a>

Awesome Promises Awesome

A curated list of useful resources for JavaScript Promises

Inspired by the awesome list thing. Not to be confused with other awesome promises like “I promise you a million dollars” or “I promise you’ll stay fit and never have to go to the gym again”.

Resources, Blogs, and Books

Promises/A+ Implementations (ES6/ES2015 compatible)

Strict Implementations

These implement no more or less than the es6 spec. They make great polyfills and are exceptionally compatible with native promises.

Implementations with extras

All of these provide more features than the language yet remain compatible. Node + Browsers for all.

  • bluebird - Fully featured, extremely performant. Long stack traces & generator/coroutine support.
  • rsvp.js - Lightweight with a few extras. Compatible down to IE6!
  • Q - One of the original implementations. Long stack traces and other goodies.
  • then/promise - Small with nodeify, denodify and done() additions.
  • when.js - Packed with control flow, functional, and utility methods.

Fallbacks

  • native-or-bluebird - Helps transition to completely native.
  • pinkie-promise - Use native, or fall back to pinkie. Great for node library authors.
  • any-promise - Loads the first available implementation. Safe for browserify.

Convenience Utilities

Native and strictly spec-compliant promises are awesome for compatibility, future-proofness, library authors, and browsers. However, libraries like bluebird patch goodies onto the Promise constructor and prototype. Solution? tiny modules of course!

  • pify - Promisify (“denofify”) a callback-style function.

  • promise-every - Standalone bluebird.every. Execute one after the other sequentially.

  • promise-filter - Standalone bluebird.filter. Filter an array to a promise.

  • promise-map - Standalone bluebird.map. Map an array to a promise.

  • promise-method - Standalone bluebird.method. Turn a synchronously-returning method into a promise-returning one.

  • promise-props - Standalone implementation of bluebird’s bluebird.props or rsvp’s RSVP.hash

  • promise-reduce - Standalone bluebird.reduce. Reduce an array to a promise.

  • promise-some - Standalone bluebird.some. Check if an element passes the predicate, return a promise.

  • promise-try - Standalone bluebird.try. Execute a synchronously-returning function and return a promise.

  • is-promise - Determine if something looks like a Promise.

  • sprom - Resolve when a stream ends. Optional buffering (be careful with this!)

  • task.js - Write async functions in a blocking style using promises and generators. Like bluebird.coroutine.

  • co - Like task.js and bluebird.coroutine, but supports thunks too.

3 回复

顶,学习一下,现在还在使用传统的回调,promise还没用过!

正在看promise,感谢桑总监~~

顶, 学习.

回到顶部