# jsonp

> A sane JSONP implementation.

Latest version **0.2.1** (published 2016-12-08) · 0 weekly downloads

## Install

```sh
npm install jsonp
pnpm add jsonp
yarn add jsonp
bun add jsonp
```

## Health

**Score 18/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2016-12-08 |
| First published | 2012-07-04 |
| Weekly downloads | 0 |
| TypeScript types | separate (@types/jsonp) |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1886 |
| Maintainers | feross, rauchg, tootallnate |

## Links

- npm: https://www.npmjs.com/package/jsonp
- Repository: https://github.com/LearnBoost/jsonp
- Homepage: https://github.com/LearnBoost/jsonp#readme
- Issues: https://github.com/LearnBoost/jsonp/issues
- npm.io page: https://npm.io/package/jsonp

## Dependencies (1)

- [debug](https://npm.io/package/debug.md) ^2.1.3

## Recent versions

- 0.2.1 (latest) — 2016-12-08
- 0.2.0 — 2015-03-19
- 0.1.0 — 2014-12-31
- 0.0.4 — 2014-06-03
- 0.0.3 — 2013-02-04
- 0.0.2 — 2013-02-04
- 0.0.1 — 2012-07-04

## README

# jsonp

A simple JSONP implementation.

[![saucelabs][saucelabs-image]][saucelabs-url]

## Installation

Install for node.js or browserify using `npm`:

``` bash
$ npm install jsonp
```

Install for component(1) using `component`:

``` bash
$ component install LearnBoost/jsonp
```

Install for browser using `bower`:

``` bash
$ bower install jsonp
```

## API

### jsonp(url, opts, fn)

- `url` (`String`) url to fetch
- `opts` (`Object`), optional
  - `param` (`String`) name of the query string parameter to specify
    the callback (defaults to `callback`)
  - `timeout` (`Number`) how long after a timeout error is emitted. `0` to
    disable (defaults to `60000`)
  - `prefix` (`String`) prefix for the global callback functions that
    handle jsonp responses (defaults to `__jp`)
  - `name` (`String`) name of the global callback functions that
    handle jsonp responses (defaults to `prefix` + incremented counter)
- `fn` callback

The callback is called with `err, data` parameters.

If it times out, the `err` will be an `Error` object whose `message` is
`Timeout`.

Returns a function that, when called, will cancel the in-progress jsonp request
(`fn` won't be called).

## License

MIT

[saucelabs-image]: https://saucelabs.com/browser-matrix/jsonp.svg
[saucelabs-url]: https://saucelabs.com/u/jsonp

---
_Source: https://npm.io/package/jsonp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
