From 844a80289752e4a02c6c1f992eb4e9f7a6656acd Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Sat, 18 Apr 2015 02:58:04 +0800 Subject: [PATCH] Fix bluebird formatting --- bluebird.md | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/bluebird.md b/bluebird.md index 70b21de4e..568805a08 100644 --- a/bluebird.md +++ b/bluebird.md @@ -3,29 +3,28 @@ title: bluebird.js layout: default --- -See [promise](promise.html). - -### Consuming promises +Also see the [promise cheatsheet](promise.html). +{:.center.brief-intro} ```js promise .then(okFn, errFn) - .spread(okFn, errFn) #* + .spread(okFn, errFn) //* .catch(errFn) - .catch(TypeError, errFn) #* - .finally(fn) #* + .catch(TypeError, errFn) //* + .finally(fn) //* .map(function (e) { ... }) - .each(function (e) { ... }); + .each(function (e) { ... }) ``` -### Handling simultaneous promises +### Simultaneous promises (array) ```js Promise.any(promises) // succeeds if one succeeds first .then(...) ``` -or Objects +### Simultaneous promises (object) ```js Promise.props({ @@ -38,12 +37,6 @@ Promise.props({ }) ``` -### Consuming arrays - -```js -getFiles() -``` - ### Chain of promises ```js @@ -51,6 +44,7 @@ Promise.try(function () { if (err) throw new Error("boo"); return result; }); +``` ### Working with node-style functions @@ -59,6 +53,6 @@ var readFile = Promise.promisify(fs.readFile); var fs = Promise.promisifyAll(require('fs')); ``` -### References +## References - * https://github.com/petkaantonov/bluebird/blob/master/API.md + * [Bluebird API](https://github.com/petkaantonov/bluebird/blob/master/API.md) (github.com)