mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 22:01:20 -08:00
refactor(core): [CORE-20] type entry and converge initialization
This commit is contained in:
1 parent
ccf77c4ed2
commit
ee895a558f
100 files changed
+33854
-839
No files matched your search
@@ -5,7 +5,7 @@ import { isClosing } from '../../lifecycle/instance'
|
||||
export type PlaybackTimes = Record<string, number>
|
||||
|
||||
export interface PlaybackStorage {
|
||||
get: (key: 'times') => PlaybackTimes | null | undefined
|
||||
get: (key: 'times') => unknown
|
||||
set: (key: 'times', value: PlaybackTimes) => void
|
||||
del: (key: 'times') => void
|
||||
}
|
||||
@@ -19,7 +19,9 @@ export interface PlaybackRecordHost extends SubscriptionHost<{ 'video:timeupdate
|
||||
}
|
||||
|
||||
export function readTimes(storage: PlaybackStorage): PlaybackTimes {
|
||||
return storage.get('times') || {}
|
||||
// Historical storage is unvalidated JSON. Keep its truthy fallback and localize
|
||||
// the legacy record assumption to this consumer, rather than all Storage reads.
|
||||
return (storage.get('times') || {}) as PlaybackTimes
|
||||
}
|
||||
|
||||
export function installPlaybackRecords(art: PlaybackRecordHost): void {
|
||||
|
||||
Reference in new issue
Block a user