# iframe-message-js

> #### iframe 父子窗口通信工具

Latest version **1.1.2** (published 2023-03-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install iframe-message-js
pnpm add iframe-message-js
yarn add iframe-message-js
bun add iframe-message-js
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2023-03-18 |
| First published | 2023-02-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | lwj1426282929 |
| Maintainers | lwj1426282929 |
| Keywords | iframe, iframe-message, message |

## Links

- npm: https://www.npmjs.com/package/iframe-message-js
- Repository: https://gitee.com/lwj1426282929/iframe-message
- npm.io page: https://npm.io/package/iframe-message-js

## Recent versions

- 1.1.2 (latest) — 2023-03-18
- 1.1.1 — 2023-03-07
- 1.1.0 — 2023-03-07
- 1.0.10 — 2023-03-04
- 1.0.9 — 2023-02-02
- 1.0.8 — 2023-02-02
- 1.0.7 — 2023-02-02
- 1.0.6 — 2023-02-02
- 1.0.5 — 2023-02-02
- 1.0.4 — 2023-02-02
- 1.0.3 — 2023-02-02
- 1.0.2 — 2023-02-02
- 1.0.1 — 2023-02-02
- 1.0.0 — 2023-02-02

## README

# iframe-message-js

#### iframe 父子窗口通信工具

#### 安装

##### npm

```bash
npm i iframe-message-js
```

##### browser

```js
<script src="https://unpkg.com/iframe-message-js/dist/index.umd.js"></script>
```

#### 使用

```js
import iframeMessage from "iframe-message-js";

// 发送消息
iframeMessage.dispatch("ADD_PAGE", "pageInfo");

// 接收消息
iframeMessage.on("ADD_PAGE", function (data) {
  console.log(data); // "pageInfo"
});
```

| 方法名   | 说明     | 参数                          | 返回值 |
| -------- | -------- | ----------------------------- | ------ |
| dispatch | 发送消息 | （eventType, data）           | -      |
| on       | 接收消息 | （eventType, callback(data)） | -      |

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