Volume controlled; Volume change only trigger event if volume is different

This commit is contained in:
James Barnsley
2016-10-20 17:40:18 +13:00
parent 9e2b5aac3a
commit d659eec7ab
2 changed files with 7 additions and 2 deletions

4
src/js/bootstrap.js vendored
View File

@ -20,7 +20,9 @@ let reducers = combineReducers({
var initialState = {
mopidy: {
host: window.location.hostname,
port: 6680
port: 6680,
volume: 0,
progress: 0
},
spotify: {
country: 'NZ',

View File

@ -16,7 +16,10 @@ export default class VolumeSlider extends React.Component{
}
handleChange(e){
this.props.onChange( parseInt(e.target.value) )
var newVolume = parseInt(e.target.value);
if( this.props.volume != newVolume ){
this.props.onChange( newVolume )
}
}
render(){