Mention you need to .bind when Promisifying library
Otherwise it won't work!
This commit is contained in:
parent
4072eb73ac
commit
b264272eea
1 changed files with 10 additions and 0 deletions
10
README.md
10
README.md
|
@ -25,6 +25,16 @@ Require the library and initialize it with your account key:
|
||||||
var Bing = require('node-bing-api')({ accKey: "your-account-key" });
|
var Bing = require('node-bing-api')({ accKey: "your-account-key" });
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Promises
|
||||||
|
|
||||||
|
This API provdes callbacks by default, but users of node 8 and newer can make th library return Promises with `util.promisify()`. For example, to use `Bing.web`:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var util = require('util'),
|
||||||
|
Bing = require('node-bing-api')({ accKey: 'someKey' }),
|
||||||
|
searchBing = util.promisify(Bing.web.bind(Bing));
|
||||||
|
```
|
||||||
|
|
||||||
#### Web Search (same as Composite):
|
#### Web Search (same as Composite):
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue