From 0aa9189d17b10eab8d75020e0f7d96a991087da6 Mon Sep 17 00:00:00 2001 From: Harvey Date: Wed, 31 Aug 2022 15:26:52 +0800 Subject: [PATCH] update d.ts --- docs/assets/ts/artplayer.d.ts | 22 +++++++++------------- packages/artplayer/types/artplayer.d.ts | 22 +++++++++------------- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/docs/assets/ts/artplayer.d.ts b/docs/assets/ts/artplayer.d.ts index 7a7dd71f4..ae7b12112 100644 --- a/docs/assets/ts/artplayer.d.ts +++ b/docs/assets/ts/artplayer.d.ts @@ -174,7 +174,7 @@ type Component = { type PluginFunction = (art: Artplayer) => any | ((option: any) => (art: Artplayer) => any); type CustomType = (video: HTMLVideoElement, url: string, art: Artplayer) => any; -type WhitelistFunction = (ua: string) => Boolean; +type WhitelistFunction = (ua: string) => boolean; type EventCallback = (event: Event) => any; type SubtitleOption = { @@ -712,13 +712,9 @@ declare class Artplayer extends Player { emit(name: Events): void; off(name: Events, callback?: Function): void; - query(selector: string): HTMLElement; - proxy( - target: HTMLElement, - name: string, - callback: EventCallback, - option?: { passive?: boolean; once?: boolean; capture?: boolean } | Boolean, - ): Function; + query: Artplayer['template']['query']; + proxy: Artplayer['events']['proxy']; + destroy(removeHtml?: boolean): void; readonly template: { @@ -752,11 +748,11 @@ declare class Artplayer extends Player { }; readonly events: { - proxy( - target: HTMLElement, - name: string, - callback: EventCallback, - option?: { passive?: boolean; once?: boolean; capture?: boolean } | Boolean, + proxy( + target: T, + name: K, + callback: (event: WindowEventMap[K]) => void, + options?: boolean | AddEventListenerOptions, ): Function; hover(target: HTMLElement, mouseenter?: EventCallback, mouseleave?: EventCallback): Function; loadImg(target: HTMLImageElement | string): Promise; diff --git a/packages/artplayer/types/artplayer.d.ts b/packages/artplayer/types/artplayer.d.ts index 7a7dd71f4..ae7b12112 100644 --- a/packages/artplayer/types/artplayer.d.ts +++ b/packages/artplayer/types/artplayer.d.ts @@ -174,7 +174,7 @@ type Component = { type PluginFunction = (art: Artplayer) => any | ((option: any) => (art: Artplayer) => any); type CustomType = (video: HTMLVideoElement, url: string, art: Artplayer) => any; -type WhitelistFunction = (ua: string) => Boolean; +type WhitelistFunction = (ua: string) => boolean; type EventCallback = (event: Event) => any; type SubtitleOption = { @@ -712,13 +712,9 @@ declare class Artplayer extends Player { emit(name: Events): void; off(name: Events, callback?: Function): void; - query(selector: string): HTMLElement; - proxy( - target: HTMLElement, - name: string, - callback: EventCallback, - option?: { passive?: boolean; once?: boolean; capture?: boolean } | Boolean, - ): Function; + query: Artplayer['template']['query']; + proxy: Artplayer['events']['proxy']; + destroy(removeHtml?: boolean): void; readonly template: { @@ -752,11 +748,11 @@ declare class Artplayer extends Player { }; readonly events: { - proxy( - target: HTMLElement, - name: string, - callback: EventCallback, - option?: { passive?: boolean; once?: boolean; capture?: boolean } | Boolean, + proxy( + target: T, + name: K, + callback: (event: WindowEventMap[K]) => void, + options?: boolean | AddEventListenerOptions, ): Function; hover(target: HTMLElement, mouseenter?: EventCallback, mouseleave?: EventCallback): Function; loadImg(target: HTMLImageElement | string): Promise;