1.1.2 • Published 5 years ago
promisify-jsonp v1.1.2
promisify-jsonp
Light and robust JSONP library.
Installation
$ npm install --save promisify-jsonpUsage
pjsonp(url, options);Options
| name | type | required | default value | description |
|---|---|---|---|---|
| callbackName | String | false | - | name of jsonp callback function |
| callbackNamePrefix | String | false | __jp | prefix for callbackName |
| callbackParamName | String | false | callback | parameter name of callbackName in query string |
| timeout | Number | false | 0 | request timeout(0 means no timeout) |
| params | Object | false | {} | extend parameter to query string |
| encode | Boolean | false | true | encode parameter in query string |
Example
var pjsonp = require("pjsonp");
pjsonp("https://www.example.com/jsonp")
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
});