mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 17:01:20 -08:00
refactor(core): CORE-10 type playback properties and add compatible controls view
This commit is contained in:
1 parent
44f4e083a9
commit
5e31274f1d
48 files changed
+3846
-248
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
import type { PlaybackControls } from 'artplayer'
|
||||
import type { PlaybackControls as SharedControls } from 'artplayer/types'
|
||||
|
||||
declare const art: Artplayer
|
||||
const controls: PlaybackControls = art
|
||||
const shared: SharedControls = controls
|
||||
const toggled: Promise<void> | void = shared.toggle()
|
||||
if (toggled)
|
||||
toggled.catch(() => {})
|
||||
const played: Promise<void> = controls.play()
|
||||
const paused: void = controls.pause()
|
||||
const historical: void = art.toggle()
|
||||
void [played, paused, historical]
|
||||
// @ts-expect-error A paused toggle does not return a Promise.
|
||||
const alwaysAsync: Promise<void> = controls.toggle()
|
||||
// @ts-expect-error Toggle does not report playback as a boolean.
|
||||
const boolean: boolean = controls.toggle()
|
||||
void [alwaysAsync, boolean]
|
||||
Reference in new issue
Block a user