Skip to content

Commit

Permalink
Enhancement - Add select / deselect lifecycle callbacks. PolymerEleme…
Browse files Browse the repository at this point in the history
…nts#140

Main reason for this would be the iron-pages view switching like shown in the starter-kit.
e.g. If i have an Video on an view element, you want it to stop it on deselect.
Or reloading ajax requests on select, or resetting form data to blank, ...
  • Loading branch information
bwh-rl authored Sep 14, 2016
1 parent ce51cbe commit 1a3227d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions iron-selectable.html
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@
}
this._selectionChange();
this.fire('iron-' + (isSelected ? 'select' : 'deselect'), {item: item});
// Check for callback function in the selected / deselected item and call it if it exists.
if(typeof item[isSelected ? 'selected' : 'deselected'] === 'function') {
item[isSelected ? 'selected' : 'deselected']();
}
},

_selectionChange: function() {
Expand Down

0 comments on commit 1a3227d

Please sign in to comment.