mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 08:01:20 -08:00
refactor(jassub): [PKG-JASSUB-04] migrate owned TypeScript and preserve public types
This commit is contained in:
1 parent
38e7b37878
commit
5e445b1af6
33 files changed
+3636
-61
No files matched your search
@@ -1,5 +0,0 @@
|
||||
import { registerJassub } from './registration.js'
|
||||
|
||||
export default function artplayerPluginJassub(option) {
|
||||
return art => registerJassub(art, option)
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import type { RuntimeOption } from '../types/runtime-api.js'
|
||||
import type { JassubHost } from './registration.js'
|
||||
import { registerJassub } from './registration.js'
|
||||
|
||||
export default function artplayerPluginJassub(option?: RuntimeOption) {
|
||||
return (art: JassubHost) => registerJassub(art, option)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import type { RuntimeInstance, RuntimeOption } from '../types/runtime-api.js'
|
||||
|
||||
interface VendorInstance extends RuntimeInstance {
|
||||
_destroyed?: boolean
|
||||
// Minimal write contract: the DOM setter coerces the historical numeric 20.
|
||||
_canvasParent?: { style: { zIndex: string | number } }
|
||||
}
|
||||
|
||||
declare const JASSUB: {
|
||||
new (option: RuntimeOption): VendorInstance
|
||||
}
|
||||
export default JASSUB
|
||||
+8
-1
@@ -1,6 +1,13 @@
|
||||
import type { RuntimeOption, RuntimeResult } from '../types/runtime-api.js'
|
||||
import JASSUB from './jassub.es.js'
|
||||
|
||||
export function registerJassub(art, option) {
|
||||
export interface JassubHost {
|
||||
video: HTMLVideoElement
|
||||
on: (name: 'destroy', callback: () => void) => unknown
|
||||
off: (name: 'destroy', callback: () => void) => unknown
|
||||
}
|
||||
|
||||
export function registerJassub(art: JassubHost, option?: RuntimeOption): RuntimeResult {
|
||||
const instance = new JASSUB({ video: art.video, ...option })
|
||||
let disposed = false
|
||||
const dispose = () => {
|
||||
Reference in new issue
Block a user