Skip to content

Instantly share code, notes, and snippets.

@joselo
Last active June 17, 2017 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joselo/c23a8b56e3184e1209d37c67ada56b23 to your computer and use it in GitHub Desktop.
Save joselo/c23a8b56e3184e1209d37c67ada56b23 to your computer and use it in GitHub Desktop.
Dispatch and listen event in polymer
// Dispatch
var event = {
bubbles: false,
composed: true,
detail: {
criteria: selectedCriterion
}
}
this.dispatchEvent(new CustomEvent('event', event));
// Listener
ready() {
super.ready();
this.addEventListener('event', e => this._handleEvent(e));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment