Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vpusher/x-frame

Cross document communication with frame content made easy
https://github.com/vpusher/x-frame

Last synced: about 1 month ago
JSON representation

Cross document communication with frame content made easy

Awesome Lists containing this project

README

        

# \

[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg?style=flat-square)](https://beta.webcomponents.org/element/vpusher/x-frame)

Cross document communication with frame content made easy.

Example:

```html

document.querySelector('x-frame').addEventListener('msg', function(e){
alert(e.detail.data.message)
});

```

## Installation

First, make sure you have [Bower](https://bower.io/) and the [Polymer CLI](https://www.npmjs.com/package/polymer-cli) installed.

Then,

```
bower install
polymer serve -o
```

## Usage

Add a `` element to your page and set the `src` attribute:

```html

[...]

```

The target page (here `frame.html`) needs to contain at least one `` element to enable the cross document communication:

```html

[...]

```

The frame document can also contain more than one `` element to allow multi-channels cross document communication:

```html

[...]

```

> This is helpful for the separation of concerns.

## Contributing

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

## History

* **1.0.0:** initial release.

## License

MIT license