mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 09:41:20 -08:00
refactor(core): CORE-18 type builtins and own prompt lifetimes
This commit is contained in:
1 parent
a842058136
commit
98a1800032
55 files changed
+26511
-650
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import type { ResumePromptHost } from './auto-playback/prompt'
|
||||
import type { PlaybackRecordHost } from './auto-playback/records'
|
||||
import { installResumePrompt } from './auto-playback/prompt'
|
||||
import { installPlaybackRecords, readTimes } from './auto-playback/records'
|
||||
|
||||
export type AutoPlaybackHost = ResumePromptHost & PlaybackRecordHost
|
||||
|
||||
export default function autoPlayback(art: AutoPlaybackHost) {
|
||||
const { storage } = art
|
||||
// Keep time recording before the prompt's first-update timer subscription.
|
||||
const installPrompt = installResumePrompt(art)
|
||||
installPlaybackRecords(art)
|
||||
installPrompt()
|
||||
return {
|
||||
name: 'auto-playback',
|
||||
get times() {
|
||||
return readTimes(storage)
|
||||
},
|
||||
clear() {
|
||||
return storage.del('times')
|
||||
},
|
||||
delete(id: string) {
|
||||
const times = readTimes(storage)
|
||||
delete times[id]
|
||||
storage.set('times', times)
|
||||
return times
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user