fix oxlint warnings (#26634)
This commit is contained in:
@@ -127,7 +127,7 @@ export default class AudioPlayer {
|
||||
}
|
||||
catch {
|
||||
this.isLoadData = false
|
||||
this.callback && this.callback('error')
|
||||
this.callback?.('error')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,15 +137,14 @@ export default class AudioPlayer {
|
||||
if (this.audioContext.state === 'suspended') {
|
||||
this.audioContext.resume().then((_) => {
|
||||
this.audio.play()
|
||||
this.callback && this.callback('play')
|
||||
this.callback?.('play')
|
||||
})
|
||||
}
|
||||
else if (this.audio.ended) {
|
||||
this.audio.play()
|
||||
this.callback && this.callback('play')
|
||||
this.callback?.('play')
|
||||
}
|
||||
if (this.callback)
|
||||
this.callback('play')
|
||||
this.callback?.('play')
|
||||
}
|
||||
else {
|
||||
this.isLoadData = true
|
||||
@@ -189,24 +188,24 @@ export default class AudioPlayer {
|
||||
if (this.audio.paused) {
|
||||
this.audioContext.resume().then((_) => {
|
||||
this.audio.play()
|
||||
this.callback && this.callback('play')
|
||||
this.callback?.('play')
|
||||
})
|
||||
}
|
||||
else if (this.audio.ended) {
|
||||
this.audio.play()
|
||||
this.callback && this.callback('play')
|
||||
this.callback?.('play')
|
||||
}
|
||||
else if (this.audio.played) { /* empty */ }
|
||||
|
||||
else {
|
||||
this.audio.play()
|
||||
this.callback && this.callback('play')
|
||||
this.callback?.('play')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public pauseAudio() {
|
||||
this.callback && this.callback('paused')
|
||||
this.callback?.('paused')
|
||||
this.audio.pause()
|
||||
this.audioContext.suspend()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user