# @harexs/jsonp

> A simple promiseify jsonp

Latest version **1.2.1** (published 2024-05-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install @harexs/jsonp
pnpm add @harexs/jsonp
yarn add @harexs/jsonp
bun add @harexs/jsonp
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2024-05-06 |
| First published | 2024-04-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 15.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Harexs |
| Maintainers | gu1st |
| Keywords | jsonp, promiseify-jsonp |

## Links

- npm: https://www.npmjs.com/package/@harexs/jsonp
- Repository: https://github.com/Gu1st/jsonp
- Homepage: https://github.com/Gu1st/jsonp#readme
- Issues: https://github.com/Gu1st/jsonp/issues
- npm.io page: https://npm.io/package/@harexs/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

- 1.2.1 (latest) — 2024-05-06
- 1.2.0 — 2024-04-30
- 1.0.0 — 2024-04-30

## README

# Harexs-Jsonp

A simple promiseify jsonp

## Useage

> npm install @harexs/jsonp

> yarn install @harexs/jsonp

> pnpm install @harexs/jsonp

```js
import Jsonp from "@harexs/jsonp";

Jsonp(url, params, options).then((res) => {
  if (res.code === 200) {
    //success
  } else if (res.code === 400) {
    // success but response empty
  } else if (res.code === 500) {
    // script error and file load fail
  }
});

// await
const res = await Jsonp(url, params, options);
```

## Example

```js
Jsonp("http://127.0.0.1/api/print", { url: "xx", fileName: "xx" }, { timeout: 10000 }, options).then((res) => {
  console.log(res.data);
});
```

## Type

```ts
interface JsonpRes<T> {
  code: JsonpResCode;
  data: T | null;
}

type JsonpResCode = 200 | 400 | 500;

type JsonpOptions = {
  timeout?: number;
  callbackName?: string;
  insertDom?: HTMLElement; //  default document.body
};
```

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