mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 17:51:20 -08:00
refactor(danmuku): [PKG-DANMUKU-06] migrate runtime and preserve public types
This commit is contained in:
1 parent
abc8008da7
commit
24b883d862
64 files changed
+14020
-633
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import type { Option, Result } from 'artplayer-plugin-danmuku'
|
||||
import danmuku from 'artplayer-plugin-danmuku'
|
||||
import legacy from 'artplayer-plugin-danmuku/legacy'
|
||||
|
||||
const legacyFactory: typeof danmuku = legacy
|
||||
const rootFactory: typeof legacy = danmuku
|
||||
const option: Option = { danmuku: [], points: [{ time: 1, value: 2 }] }
|
||||
danmuku(option)
|
||||
legacy(option)
|
||||
declare const result: Result
|
||||
const synchronous: Result = result.emit({ text: 'historical declaration' })
|
||||
void [legacyFactory, rootFactory, synchronous]
|
||||
|
||||
// @ts-expect-error The published root requires its option argument.
|
||||
danmuku()
|
||||
// @ts-expect-error The published root requires danmuku in Option.
|
||||
danmuku({})
|
||||
// @ts-expect-error Preserve historical object points at the root.
|
||||
danmuku({ danmuku: [], points: [[1, 2]] })
|
||||
// @ts-expect-error Root emit keeps its published synchronous Result shape.
|
||||
const asynchronous: Promise<Result> = result.emit({ text: 'old emit' })
|
||||
void asynchronous
|
||||
Reference in new issue
Block a user