only dispatch manipulator events if the state is actually changed.

This commit is contained in:
Keegan
2016-03-06 14:28:38 +11:00
parent bdcd820f7c
commit 069d4a80da
5 changed files with 104 additions and 20 deletions
+9 -2
View File
@@ -16,11 +16,18 @@ module.exports = {
var $value = self.$element.select('.value');
self.on('change', function() {
/**
* Updates the HTML value of the component to match the slected option's label
* @return {void}
*/
function setValueDisplay() {
var selectedIndex = self.$manipulatorTarget.get('selectedIndex');
var $options = self.$manipulatorTarget.select('option');
var value = $options[selectedIndex] && $options[selectedIndex].innerHTML;
$value.set('innerHTML', value);
});
}
setValueDisplay();
self.on('change', setValueDisplay);
}
};