Upgrade ESlint to v8 (#23305)
This commit is contained in:
parent
b58bf74e35
commit
c49213f0ea
120 changed files with 832 additions and 810 deletions
|
@ -75,7 +75,7 @@ class Audio extends React.PureComponent {
|
|||
if (this.player) {
|
||||
this._setDimensions();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_pack() {
|
||||
return {
|
||||
|
@ -105,11 +105,11 @@ class Audio extends React.PureComponent {
|
|||
|
||||
setSeekRef = c => {
|
||||
this.seek = c;
|
||||
}
|
||||
};
|
||||
|
||||
setVolumeRef = c => {
|
||||
this.volume = c;
|
||||
}
|
||||
};
|
||||
|
||||
setAudioRef = c => {
|
||||
this.audio = c;
|
||||
|
@ -118,13 +118,13 @@ class Audio extends React.PureComponent {
|
|||
this.audio.volume = 1;
|
||||
this.audio.muted = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
setCanvasRef = c => {
|
||||
this.canvas = c;
|
||||
|
||||
this.visualizer.setCanvas(c);
|
||||
}
|
||||
};
|
||||
|
||||
componentDidMount () {
|
||||
window.addEventListener('scroll', this.handleScroll);
|
||||
|
@ -163,7 +163,7 @@ class Audio extends React.PureComponent {
|
|||
} else {
|
||||
this.setState({ paused: true }, () => this.audio.pause());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
handleResize = debounce(() => {
|
||||
if (this.player) {
|
||||
|
@ -181,7 +181,7 @@ class Audio extends React.PureComponent {
|
|||
}
|
||||
|
||||
this._renderCanvas();
|
||||
}
|
||||
};
|
||||
|
||||
handlePause = () => {
|
||||
this.setState({ paused: true });
|
||||
|
@ -189,7 +189,7 @@ class Audio extends React.PureComponent {
|
|||
if (this.audioContext) {
|
||||
this.audioContext.suspend();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
handleProgress = () => {
|
||||
const lastTimeRange = this.audio.buffered.length - 1;
|
||||
|
@ -197,7 +197,7 @@ class Audio extends React.PureComponent {
|
|||
if (lastTimeRange > -1) {
|
||||
this.setState({ buffer: Math.ceil(this.audio.buffered.end(lastTimeRange) / this.audio.duration * 100) });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
toggleMute = () => {
|
||||
const muted = !this.state.muted;
|
||||
|
@ -207,7 +207,7 @@ class Audio extends React.PureComponent {
|
|||
this.gainNode.gain.value = muted ? 0 : this.state.volume;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
toggleReveal = () => {
|
||||
if (this.props.onToggleVisibility) {
|
||||
|
@ -215,7 +215,7 @@ class Audio extends React.PureComponent {
|
|||
} else {
|
||||
this.setState({ revealed: !this.state.revealed });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
handleVolumeMouseDown = e => {
|
||||
document.addEventListener('mousemove', this.handleMouseVolSlide, true);
|
||||
|
@ -227,14 +227,14 @@ class Audio extends React.PureComponent {
|
|||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
};
|
||||
|
||||
handleVolumeMouseUp = () => {
|
||||
document.removeEventListener('mousemove', this.handleMouseVolSlide, true);
|
||||
document.removeEventListener('mouseup', this.handleVolumeMouseUp, true);
|
||||
document.removeEventListener('touchmove', this.handleMouseVolSlide, true);
|
||||
document.removeEventListener('touchend', this.handleVolumeMouseUp, true);
|
||||
}
|
||||
};
|
||||
|
||||
handleMouseDown = e => {
|
||||
document.addEventListener('mousemove', this.handleMouseMove, true);
|
||||
|
@ -248,7 +248,7 @@ class Audio extends React.PureComponent {
|
|||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
};
|
||||
|
||||
handleMouseUp = () => {
|
||||
document.removeEventListener('mousemove', this.handleMouseMove, true);
|
||||
|
@ -258,7 +258,7 @@ class Audio extends React.PureComponent {
|
|||
|
||||
this.setState({ dragging: false });
|
||||
this.audio.play();
|
||||
}
|
||||
};
|
||||
|
||||
handleMouseMove = throttle(e => {
|
||||
const { x } = getPointerPosition(this.seek, e);
|
||||
|
@ -276,7 +276,7 @@ class Audio extends React.PureComponent {
|
|||
currentTime: this.audio.currentTime,
|
||||
duration: this.audio.duration,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
handleMouseVolSlide = throttle(e => {
|
||||
const { x } = getPointerPosition(this.volume, e);
|
||||
|
@ -311,11 +311,11 @@ class Audio extends React.PureComponent {
|
|||
|
||||
handleMouseEnter = () => {
|
||||
this.setState({ hovered: true });
|
||||
}
|
||||
};
|
||||
|
||||
handleMouseLeave = () => {
|
||||
this.setState({ hovered: false });
|
||||
}
|
||||
};
|
||||
|
||||
handleLoadedData = () => {
|
||||
const { autoPlay, currentTime } = this.props;
|
||||
|
@ -327,7 +327,7 @@ class Audio extends React.PureComponent {
|
|||
if (autoPlay) {
|
||||
this.togglePlay();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_initAudioContext () {
|
||||
const AudioContext = window.AudioContext || window.webkitAudioContext;
|
||||
|
@ -361,7 +361,7 @@ class Audio extends React.PureComponent {
|
|||
}).catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
_renderCanvas () {
|
||||
requestAnimationFrame(() => {
|
||||
|
@ -432,7 +432,7 @@ class Audio extends React.PureComponent {
|
|||
e.stopPropagation();
|
||||
this.togglePlay();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
handleKeyDown = e => {
|
||||
switch(e.key) {
|
||||
|
@ -457,7 +457,7 @@ class Audio extends React.PureComponent {
|
|||
this.seekBy(10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { src, intl, alt, editable, autoPlay, sensitive, blurhash } = this.props;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue