# cross-domain-events

> Event-like api for postMessage to send objects between cross-domain frames

Latest version **0.0.4** (published 2015-04-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install cross-domain-events
pnpm add cross-domain-events
yarn add cross-domain-events
bun add cross-domain-events
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2015-04-21 |
| First published | 2014-02-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | FINN.no AS |
| Maintainers | gregersrygg, sslash, finn-no, sveisvei |
| Keywords | cross-domain, postmessage, xde, events, pubsub |

## Links

- npm: https://www.npmjs.com/package/cross-domain-events
- Repository: git@github.com:finn-no/cross-domain-events
- Homepage: https://github.com/finn-no/cross-domain-events
- Issues: https://github.com/finn-no/cross-domain-events/issues
- npm.io page: https://npm.io/package/cross-domain-events

## Dependencies (1)

- [eventlistener](https://npm.io/package/eventlistener.md) 0.0.1

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 0.0.4 (latest) — 2015-04-21
- 0.0.3 — 2015-04-14
- 0.0.2 — 2014-02-24
- 0.0.1 — 2014-02-19

## README

cross-domain-events
===================

An event-like interface to postMessage for cross domain communication.

[![Build Status](https://travis-ci.org/finn-no/cross-domain-events.png)](https://travis-ci.org/finn-no/cross-domain-events)

[![Sauce Test Status](https://saucelabs.com/browser-matrix/cross-domain-events.svg)](https://saucelabs.com/u/cross-domain-events)


postMessage was implemented in Internet Explorer 8, but only supports sending text strings. Modern browsers can send objects, but if you want to listen for different kind of objects you have to implement your own delegation.

Example
=======

	// notify parent about page size
	xde.sendTo(window.top, "resize", {
		width: iframe.clientWidth,
		height: iframe.clientHeight
	});

	// parent page
	xde.on("resize", function (evt) {
		var iframe = document.getElementById("theiframe");
		iframe.style.width = evt.data.width;
		iframe.style.height = evt.data.height;
	});

Works in IE8 & IE9 as long as you have ES5-shim (for Array.prototype.filter) and JSON.js already.

License
=======

MIT

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