npm-polymer-elements
Version:
Polymer Elements package for npm
41 lines (22 loc) • 1.13 kB
Markdown
<!---
This README is automatically generated from the comments in these files:
iron-signals.html
Edit those files, and our readme bot will duplicate them over here!
Edit this file, and the bot will squash your changes :)
-->
[](https://travis-ci.org/PolymerElements/iron-signals)
_[Demo and API Docs](https://elements.polymer-project.org/elements/iron-signals)_
`iron-signals` provides basic publish-subscribe functionality.
Note: avoid using `iron-signals` whenever you can use
a controller (parent element) to mediate communication
instead.
To send a signal, fire a custom event of type `iron-signal`, with
a detail object containing `name` and `data` fields.
this.fire('iron-signal', {name: 'hello', data: null});
To receive a signal, listen for `iron-signal-<name>` event on a
`iron-signals` element.
<iron-signals on-iron-signal-hello="{{helloSignal}}">
You can fire a signal event from anywhere, and all
`iron-signals` elements will receive the event, regardless
of where they are in DOM.