https://github.com/hanai/promisify-jsonp
Promisify JSONP
https://github.com/hanai/promisify-jsonp
javascript jsonp npm promise
Last synced: 3 months ago
JSON representation
Promisify JSONP
- Host: GitHub
- URL: https://github.com/hanai/promisify-jsonp
- Owner: hanai
- License: mit
- Created: 2019-06-20T08:36:30.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-09-26T16:53:26.000Z (almost 6 years ago)
- Last Synced: 2025-06-03T22:01:07.760Z (about 1 year ago)
- Topics: javascript, jsonp, npm, promise
- Language: JavaScript
- Size: 39.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# promisify-jsonp
[![NPM version][npm-image]][npm-url]
[![License][license-image]][license-url]
Light and robust JSONP library.
## Installation
```sh
$ npm install --save promisify-jsonp
```
## Usage
```js
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
```js
var pjsonp = require("pjsonp");
pjsonp("https://www.example.com/jsonp")
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
});
```
## License
[MIT](./LICENSE)
[npm-image]: https://img.shields.io/npm/v/promisify-jsonp.svg?style=flat-square
[npm-url]: https://npmjs.org/package/promisify-jsonp
[license-image]: https://img.shields.io/badge/license-MIT-blue.svg
[license-url]: ./LICENSE