减少歌词定时器调用阈值
parent
2a8bfac2c5
commit
cfe78fc387
|
@ -69,8 +69,8 @@ module.exports = class FontPlayer {
|
|||
|
||||
this.lineContent = null
|
||||
|
||||
this.timeoutTools = new TimeoutTools(80)
|
||||
this.waitPlayTimeout = new TimeoutTools(80)
|
||||
this.timeoutTools = new TimeoutTools(50)
|
||||
this.waitPlayTimeout = new TimeoutTools(50)
|
||||
|
||||
this._init()
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
const getNow = exports.getNow = typeof performance == 'object' && window.performance.now ? window.performance.now.bind(window.performance) : Date.now.bind(Date)
|
||||
|
||||
exports.TimeoutTools = class TimeoutTools {
|
||||
constructor(thresholdTime = 200) {
|
||||
constructor(thresholdTime = 80) {
|
||||
this.invokeTime = 0
|
||||
this.animationFrameId = null
|
||||
this.timeoutId = null
|
||||
|
@ -17,6 +17,7 @@ exports.TimeoutTools = class TimeoutTools {
|
|||
// console.log('diff', diff)
|
||||
if (diff > 0) {
|
||||
if (diff < this.thresholdTime) return this.run()
|
||||
// console.log('run timeout', diff, diff - this.thresholdTime)
|
||||
return this.timeoutId = window.setTimeout(() => {
|
||||
this.timeoutId = null
|
||||
this.run()
|
||||
|
|
Loading…
Reference in New Issue