Bluebird: update URLs

This commit is contained in:
Rico Sta. Cruz 2016-12-27 01:01:36 +08:00
parent b7e4c06ce7
commit e631764d09
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
1 changed files with 15 additions and 7 deletions

View File

@ -21,7 +21,7 @@ promise
---- ----
### Multiple return values ### Multiple return values
Use [Promise.spread](https://github.com/petkaantonov/bluebird/blob/master/API.md#spreadfunction-fulfilledhandler--function-rejectedhandler----promise). Use [Promise.spread](http://bluebirdjs.com/docs/api/promise.spread.html).
```js ```js
.then(function () { .then(function () {
@ -33,7 +33,7 @@ Use [Promise.spread](https://github.com/petkaantonov/bluebird/blob/master/API.md
``` ```
### Multiple promises ### Multiple promises
Use [Promise.join](https://github.com/petkaantonov/bluebird/blob/master/API.md#promisejoinpromisethenablevalue-promises-function-handler---promise) for fixed number of multiple promises. Use [Promise.join](http://bluebirdjs.com/docs/api/promise.join.html).
```js ```js
Promise.join( Promise.join(
@ -47,7 +47,11 @@ Promise.join(
``` ```
### Multiple promises (array) ### Multiple promises (array)
Use `.all`, `.any`, `.race`, or `.some`. Use
[.all](http://bluebirdjs.com/docs/api/promise.all.html),
[.any](http://bluebirdjs.com/docs/api/promise.any.html),
[.race](http://bluebirdjs.com/docs/api/promise.race.html), or
[.some](http://bluebirdjs.com/docs/api/promise.some.html).
```js ```js
Promise.all([ promise1, promise2 ]) Promise.all([ promise1, promise2 ])
@ -77,7 +81,7 @@ Promise.props({
``` ```
### Chain of promises ### Chain of promises
Use [Promise.try](https://github.com/petkaantonov/bluebird/blob/master/API.md#promisetryfunction-fn--arraydynamicdynamic-arguments--dynamic-ctx----promise) to start a chain. Use [Promise.try](http://bluebirdjs.com/docs/api/promise.try.html).
```js ```js
function getPhotos() { function getPhotos() {
@ -91,7 +95,7 @@ getPhotos().then(...)
``` ```
### Using Node-style functions ### Using Node-style functions
See [Promisification](https://github.com/petkaantonov/bluebird/blob/master/API.md#promisification) API. See [Promisification](http://bluebirdjs.com/docs/api/promisification.html).
```js ```js
var readFile = Promise.promisify(fs.readFile); var readFile = Promise.promisify(fs.readFile);
@ -99,7 +103,7 @@ var fs = Promise.promisifyAll(require('fs'));
``` ```
### Promise-returning methods ### Promise-returning methods
See [Promise.method](https://github.com/petkaantonov/bluebird/blob/master/API.md#promisemethodfunction-fn---function) to allow `return`ing values that will be promise resolutions. See [Promise.method](http://bluebirdjs.com/docs/api/promise.method.html).
```js ```js
User.login = Promise.method(function(email, password) { User.login = Promise.method(function(email, password) {
@ -111,7 +115,7 @@ User.login = Promise.method(function(email, password) {
``` ```
### Generators ### Generators
See [Promise.coroutine](https://github.com/petkaantonov/bluebird/blob/master/API.md#promisecoroutinegeneratorfunction-generatorfunction---function). See [Promise.coroutine](http://bluebirdjs.com/docs/api/promise.coroutine.html).
``` ```
User.login = Promise.coroutine(function* (email, password) { User.login = Promise.coroutine(function* (email, password) {
@ -119,3 +123,7 @@ User.login = Promise.coroutine(function* (email, password) {
return user; return user;
}); });
``` ```
## Reference
<http://bluebirdjs.com/docs/api-reference.html>