Skip to content

Instantly share code, notes, and snippets.

@DaveVoyles
Last active August 29, 2015 14:17
Show Gist options
  • Save DaveVoyles/25c8032ea5a0c9142820 to your computer and use it in GitHub Desktop.
Save DaveVoyles/25c8032ea5a0c9142820 to your computer and use it in GitHub Desktop.
<script>
(function () { // IIFE makes attributes global
/* -- Global Attributes ------------------------------------------------ */
var currentAccent = 'en-US';
var accentArr = ['en-US', 'en-GB', 'es-ES'];
Polymer('x-radial-buttons', {
/* -- Methods --------------------------------------------------- */
getCurrentAccent: function () {
return currentAccent;
},
/* Easily grab different elements from the Shadow DOM, and expose them to other .js files.
* ex: document.querySelector("x-radial-buttons").getFirstElement();
*/
getFirstElement: function () {
return this.$.paper_radio_group.querySelector("#paper_radio_btn_en-US");
},
getSecondElement: function () {
return this.$.paper_radio_group.querySelector("#paper_radio_btn_en-GB");
},
getThirdElement: function () {
return this.$.paper_radio_group.querySelector("#paper_radio_btn_es-ES");
},
changeAccentUS: function(event, detail, sender) {
var accent = accentArr[0];
pokemonApp.changeAccent(accent);
},
changeAccentGB: function() {
var accent = accentArr[1];
pokemonApp.changeAccent(accent);
},
changeAccentES: function () {
var accent = accentArr[2];
pokemonApp.changeAccent(accent);
}
});
})();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment