Fix bluebird formatting

This commit is contained in:
Rico Sta. Cruz 2015-04-18 02:58:04 +08:00
parent 8fcd337179
commit 844a802897
1 changed files with 11 additions and 17 deletions

View File

@ -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)