Skip to content

Commit

Permalink
Remove arrow function brackets
Browse files Browse the repository at this point in the history
  • Loading branch information
cookpete committed May 19, 2016
1 parent 0c8070d commit cb71f30
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/ReactPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class ReactPlayer extends Component {
static propTypes = propTypes
static defaultProps = defaultProps
static canPlay (url) {
return players.some((player) => player.canPlay(url))
return players.some(player => player.canPlay(url))
}
componentDidMount () {
this.progress()
Expand All @@ -25,7 +25,7 @@ export default class ReactPlayer extends Component {
this.props.volume !== nextProps.volume
)
}
seekTo = (fraction) => {
seekTo = fraction => {
const player = this.refs.player
if (player) {
player.seekTo(fraction)
Expand All @@ -48,7 +48,7 @@ export default class ReactPlayer extends Component {
}
this.progressTimeout = setTimeout(this.progress, this.props.progressFrequency)
}
renderPlayer = (Player) => {
renderPlayer = Player => {
const active = Player.canPlay(this.props.url)
const { youtubeConfig, soundcloudConfig, vimeoConfig, ...activeProps } = this.props
const props = active ? { ...activeProps, ref: 'player' } : {}
Expand Down
16 changes: 8 additions & 8 deletions src/demo/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default class App extends Component {
loaded: 0,
duration: 0
}
load = (url) => {
load = url => {
this.setState({
url,
played: 0,
Expand All @@ -31,20 +31,20 @@ export default class App extends Component {
stop = () => {
this.setState({ url: null, playing: false })
}
setVolume = (e) => {
setVolume = e => {
this.setState({ volume: parseFloat(e.target.value) })
}
onSeekMouseDown = (e) => {
onSeekMouseDown = e => {
this.setState({ seeking: true })
}
onSeekChange = (e) => {
onSeekChange = e => {
this.setState({ played: parseFloat(e.target.value) })
}
onSeekMouseUp = (e) => {
onSeekMouseUp = e => {
this.setState({ seeking: false })
this.refs.player.seekTo(parseFloat(e.target.value))
}
onProgress = (state) => {
onProgress = state => {
// We only want to update time slider if we are not currently seeking
if (!this.state.seeking) {
this.setState(state)
Expand Down Expand Up @@ -96,9 +96,9 @@ export default class App extends Component {
onPause={() => this.setState({ playing: false })}
onBuffer={() => console.log('onBuffer')}
onEnded={() => this.setState({ playing: false })}
onError={(e) => console.log('onError', e)}
onError={e => console.log('onError', e)}
onProgress={this.onProgress}
onDuration={(duration) => this.setState({ duration })}
onDuration={duration => this.setState({ duration })}
/>

<table><tbody>
Expand Down
2 changes: 1 addition & 1 deletion src/players/FilePlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class FilePlayer extends Base {
this.player.onplay = this.onPlay
this.player.onpause = () => this.props.onPause()
this.player.onended = () => this.props.onEnded()
this.player.onerror = (e) => this.props.onError(e)
this.player.onerror = e => this.props.onError(e)
this.player.setAttribute('webkit-playsinline', '')
super.componentDidMount()
}
Expand Down
12 changes: 6 additions & 6 deletions src/players/SoundCloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class SoundCloud extends Base {
return Promise.resolve(window[SDK_GLOBAL])
}
return new Promise((resolve, reject) => {
loadScript(SDK_URL, (err) => {
loadScript(SDK_URL, err => {
if (err) {
reject(err)
} else {
Expand All @@ -44,7 +44,7 @@ export default class SoundCloud extends Base {
return Promise.resolve(songData[url])
}
return fetch(RESOLVE_URL + '?url=' + url + '&client_id=' + this.props.soundcloudConfig.clientId)
.then((response) => {
.then(response => {
if (response.status >= 200 && response.status < 300) {
songData[url] = response.json()
return songData[url]
Expand All @@ -57,8 +57,8 @@ export default class SoundCloud extends Base {
}
load (url) {
this.stop()
this.getSDK().then((SC) => {
this.getSongData(url).then((data) => {
this.getSDK().then(SC => {
this.getSongData(url).then(data => {
if (url !== this.props.url) {
return // Abort if url changes during async requests
}
Expand All @@ -70,15 +70,15 @@ export default class SoundCloud extends Base {
if (image) {
this.setState({ image: image.replace('-large', '-t500x500') })
}
SC.stream(data.uri, (player) => {
SC.stream(data.uri, player => {
this.player = player
player._player.on('stateChange', this.onStateChange)
this.onReady()
})
}, this.props.onError)
}, this.props.onError)
}
onStateChange = (state) => {
onStateChange = state => {
if (state === 'playing') this.onPlay()
if (state === 'paused') this.props.onPause()
if (state === 'loading') this.props.onBuffer()
Expand Down
2 changes: 1 addition & 1 deletion src/players/Vimeo.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default class Vimeo extends Base {
getFractionLoaded () {
return this.fractionLoaded || null
}
onMessage = (e) => {
onMessage = e => {
if (!MATCH_MESSAGE_ORIGIN.test(e.origin)) return
this.origin = this.origin || e.origin
const data = JSON.parse(e.data)
Expand Down
6 changes: 3 additions & 3 deletions src/players/YouTube.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class YouTube extends Base {
if (previousOnReady) previousOnReady()
resolve(window[SDK_GLOBAL])
}
loadScript(SDK_URL, (err) => {
loadScript(SDK_URL, err => {
if (err) reject(err)
})
})
Expand All @@ -63,7 +63,7 @@ export default class YouTube extends Base {
return
}
this.loadingSDK = true
this.getSDK().then((YT) => {
this.getSDK().then(YT => {
this.player = new YT.Player(this.playerId, {
width: '100%',
height: '100%',
Expand All @@ -80,7 +80,7 @@ export default class YouTube extends Base {
this.onReady()
},
onStateChange: this.onStateChange,
onError: (event) => this.props.onError(event.data)
onError: event => this.props.onError(event.data)
}
})
}, this.props.onError)
Expand Down

0 comments on commit cb71f30

Please sign in to comment.