mirror of
https://github.com/truewhile/MeBox.git
synced 2026-11-16 12:54:22 +08:00
优化播放逻辑
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
/** Invalidates both successful and failed responses after a newer playback intent. */
|
||||
export function createPlaybackRequestGuard() {
|
||||
let generation = 0
|
||||
return {
|
||||
begin(): () => boolean {
|
||||
const requested = ++generation
|
||||
return () => requested === generation
|
||||
},
|
||||
invalidate(): void {
|
||||
generation += 1
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user