From b264272eea08ffcbe607473ccf320dd531792773 Mon Sep 17 00:00:00 2001 From: Mike MacCana Date: Wed, 12 Jul 2017 22:35:17 +0100 Subject: [PATCH] Mention you need to .bind when Promisifying library Otherwise it won't work! --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 0df3341..b3392e6 100644 --- a/README.md +++ b/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" }); ``` +## 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): ```js