[Javascript] 非同步處理: Bluebird

Bluebird
https://github.com/petkaantonov/bluebird

Bluebird API Reference
http://bluebirdjs.com/docs/api-reference.html

使用 bluebird 實現更強大的 Promise
https://www.ibm.com/developerworks/cn/web/wa-lo-use-bluebird-implements-power-promise/index.html

Promise外部函式庫議題
https://eyesofkids.gitbooks.io/javascript-start-es6-promise/content/contents/other_libs.html

jQuery Promise 與 bluebird Promise 對應說明
https://github.com/petkaantonov/bluebird/blob/master/docs/docs/coming-from-other-libraries.md

bluebird為使用Javascript所開發,並根據Promises/A+規範所實踐的套件,並封裝許多重要的異步呼叫方法,在ECMAScript 2015的基礎上添加了很多擴展方法,如.spread()展開結果集、Promise.promisifyAll()將一個模組的屬性方法包裝成一個Promise實例,使開發者能更便利進行非同步操作資料。

需注意的是,雖然jQuery 3.0中實作了符合Promises/A+標準的Promise物件,但是jQuery並非單純用於Promise架構的外部函式庫,再加上長期以來jQuery有很多自己設計的擴充API,API的名稱與標準中有些不同。如果你原本就有使用jQuery,是可以使用它新版本中的deferred物件與Promise物件的API,但可能還是需要具備Promise的使用基礎知識比較好。


#Bluebird, Javascript, Promise, Promises/A+, ES6 Promise, 非同步, 異步, jQuery, deferred

留言