Use ES Class Fields & Static Properties (#3008)
Use ES Class Fields & Static Properties (currently stage 2) for improve class outlook. Added babel-plugin-transform-class-properties as a Babel plugin.
This commit is contained in:
parent
44a3584e2d
commit
2991a7cfe6
79 changed files with 838 additions and 1128 deletions
|
@ -3,13 +3,14 @@ import PropTypes from 'prop-types';
|
|||
|
||||
class ExtendedVideoPlayer extends React.PureComponent {
|
||||
|
||||
constructor (props, context) {
|
||||
super(props, context);
|
||||
this.handleLoadedData = this.handleLoadedData.bind(this);
|
||||
this.setRef = this.setRef.bind(this);
|
||||
}
|
||||
static propTypes = {
|
||||
src: PropTypes.string.isRequired,
|
||||
time: PropTypes.number,
|
||||
controls: PropTypes.bool.isRequired,
|
||||
muted: PropTypes.bool.isRequired
|
||||
};
|
||||
|
||||
handleLoadedData () {
|
||||
handleLoadedData = () => {
|
||||
if (this.props.time) {
|
||||
this.video.currentTime = this.props.time;
|
||||
}
|
||||
|
@ -23,7 +24,7 @@ class ExtendedVideoPlayer extends React.PureComponent {
|
|||
this.video.removeEventListener('loadeddata', this.handleLoadedData);
|
||||
}
|
||||
|
||||
setRef (c) {
|
||||
setRef = (c) => {
|
||||
this.video = c;
|
||||
}
|
||||
|
||||
|
@ -44,11 +45,4 @@ class ExtendedVideoPlayer extends React.PureComponent {
|
|||
|
||||
}
|
||||
|
||||
ExtendedVideoPlayer.propTypes = {
|
||||
src: PropTypes.string.isRequired,
|
||||
time: PropTypes.number,
|
||||
controls: PropTypes.bool.isRequired,
|
||||
muted: PropTypes.bool.isRequired
|
||||
};
|
||||
|
||||
export default ExtendedVideoPlayer;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue