# sync-jsonp

> sync jsonp for web

Latest version **0.1.2** (published 2019-06-21) · ISC license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; no vulnerabilities; high quality score.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2019-06-21 |
| First published | 2019-06-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | jackness |
| Maintainers | jackness |
| Keywords | sync, jsonp |

## Links

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

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.1.2 (latest) — 2019-06-21
- 0.1.1 — 2019-06-21
- 0.1.0 — 2019-06-21
- 0.0.1 — 2019-06-21

## README

# sync-jsonp

## 安装
```bash
npm install sync-jsonp --save
```
## 使用
```javascript
import syncJsonp from 'sync-jsonp'
```

## api
### syncJsonp(url, data, opts): Promise
- `url` (string) url to fetch
- `data` (object) send param, optional
- `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)

## example
```javascript
import syncJsonp from 'sync-jsonp';

syncJsonp('http://hostname.com/path/to/api').then((data) => {
  console.log(data);
});

syncJsonp('http://hostname.com/path/to/api', {
  t: +new Date()
}).then((data) => {
  console.log(data);
});

syncJsonp('http://hostname.com/path/to/api', undefined, {
  timeout: 2000
}).then((data) => {
  console.log(data);
});
```

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