Files
ArtPlayer/docs/assets/ts/artplayer-tool-iframe.d.ts
T
Harvey Zhao 1c75731ca9 feat: introduce ArtplayerToolIframe for iframe control
- Removed the old ArtplayerPluginIframe implementation.
- Added ArtplayerToolIframe class with methods for iframe communication.
- Implemented postMessage and onMessage methods for message handling.
- Created a new TypeScript definition file for ArtplayerToolIframe.
- Updated documentation links to point to the new iframe tool.
- Added npm ignore file and README for the new package.
- Included compiled and uncompiled versions of the new iframe tool.
- Updated package.json with relevant metadata and exports.
2026-03-07 20:58:02 +08:00

33 lines
971 B
TypeScript

interface Message {
type: string
data: any
id?: number
}
declare class ArtplayerToolIframe {
constructor(option: { iframe: HTMLIFrameElement, url: string })
static iframe: boolean
static postMessage(message: Message): void
static onMessage(event: MessageEvent & { data: Message }): void
static inject(): void
readonly promises: Record<number, { resove: (...args: any[]) => any, reject: (...args: any[]) => any }>
readonly injected: boolean
readonly destroyed: boolean
readonly $iframe: HTMLIFrameElement
readonly url: string
readonly messageCallback: (...args: any[]) => any
onMessage(event: MessageEvent & { data: Message }): void
postMessage(message: Message): Promise<any>
commit<T extends (...args: any[]) => any>(callback: T): Promise<ReturnType<T>>
message(callback: (...args: any[]) => any): void
destroy(): void
}
export default ArtplayerToolIframe
export = artplayerToolIframe
export as namespace artplayerToolIframe;