mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 02:01:20 -08:00
Update artplayer.d.ts
This commit is contained in:
1 parent
3567a487f0
commit
d906a860c9
1 file changed
+22
-15
+22
-15
@@ -1,20 +1,22 @@
|
|||||||
export = Artplayer;
|
export = Artplayer;
|
||||||
|
|
||||||
|
interface Selector {
|
||||||
|
default?: boolean;
|
||||||
|
html: string;
|
||||||
|
}
|
||||||
|
|
||||||
interface ComponentOption {
|
interface ComponentOption {
|
||||||
html: string | HTMLElement;
|
html: string | HTMLElement;
|
||||||
disable?: boolean;
|
disable?: boolean;
|
||||||
name?: string;
|
name?: string;
|
||||||
index?: number;
|
index?: number;
|
||||||
style?: object;
|
style?: object;
|
||||||
click?: Function;
|
click?(component: Component, event: Event): void;
|
||||||
mounted?: Function;
|
mounted?(element: HTMLElement): void;
|
||||||
tooltip?: string;
|
tooltip?: string;
|
||||||
position?: 'top' | 'left' | 'right';
|
position?: 'top' | 'left' | 'right';
|
||||||
selector?: {
|
selector?: Selector[];
|
||||||
default?: boolean;
|
onSelect?(selector: Selector, element: HTMLElement): void;
|
||||||
html: string;
|
|
||||||
}[];
|
|
||||||
onSelect?: Function;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Component {
|
interface Component {
|
||||||
@@ -27,6 +29,11 @@ interface Component {
|
|||||||
add(option: ComponentOption): HTMLElement;
|
add(option: ComponentOption): HTMLElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Plugin = (art: Artplayer) => any;
|
||||||
|
type WhitelistFunction = (ua: string) => Boolean;
|
||||||
|
type CustomType = (video: HTMLVideoElement, url: string, art: Artplayer) => any;
|
||||||
|
type EventCallback = (event: Event) => any;
|
||||||
|
|
||||||
interface Option {
|
interface Option {
|
||||||
container: string | HTMLElement;
|
container: string | HTMLElement;
|
||||||
url: string;
|
url: string;
|
||||||
@@ -59,8 +66,8 @@ interface Option {
|
|||||||
localVideo?: boolean;
|
localVideo?: boolean;
|
||||||
localSubtitle?: boolean;
|
localSubtitle?: boolean;
|
||||||
useSSR?: boolean;
|
useSSR?: boolean;
|
||||||
plugins?: Function[];
|
plugins?: Plugin[];
|
||||||
whitelist?: (string | Function | RegExp)[];
|
whitelist?: (string | WhitelistFunction | RegExp)[];
|
||||||
layers?: ComponentOption[];
|
layers?: ComponentOption[];
|
||||||
contextmenu?: ComponentOption[];
|
contextmenu?: ComponentOption[];
|
||||||
controls?: ComponentOption[];
|
controls?: ComponentOption[];
|
||||||
@@ -92,7 +99,7 @@ interface Option {
|
|||||||
[propName: string]: string | HTMLElement;
|
[propName: string]: string | HTMLElement;
|
||||||
};
|
};
|
||||||
customType?: {
|
customType?: {
|
||||||
[propName: string]: Function;
|
[propName: string]: CustomType;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,7 +196,7 @@ declare class Artplayer extends Player {
|
|||||||
emit(name: string): void;
|
emit(name: string): void;
|
||||||
off(name: string, callback?: Function): void;
|
off(name: string, callback?: Function): void;
|
||||||
query(selector: string): HTMLElement;
|
query(selector: string): HTMLElement;
|
||||||
proxy(target: HTMLElement, name: string, callback: Function, option?: object): Function;
|
proxy(target: HTMLElement, name: string, callback: EventCallback, option?: object): Function;
|
||||||
destroy(removeHtml?: boolean): void;
|
destroy(removeHtml?: boolean): void;
|
||||||
|
|
||||||
readonly template: {
|
readonly template: {
|
||||||
@@ -225,8 +232,8 @@ declare class Artplayer extends Player {
|
|||||||
};
|
};
|
||||||
|
|
||||||
readonly events: {
|
readonly events: {
|
||||||
proxy(target: HTMLElement, name: string, callback: Function, option?: object): Function;
|
proxy(target: HTMLElement, name: string, callback: EventCallback, option?: object): Function;
|
||||||
hover(target: HTMLElement, mouseenter?: Function, mouseleave?: Function): Function;
|
hover(target: HTMLElement, mouseenter?: EventCallback, mouseleave?: EventCallback): Function;
|
||||||
loadImg(target: HTMLImageElement | string): Promise<HTMLImageElement>;
|
loadImg(target: HTMLImageElement | string): Promise<HTMLImageElement>;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -259,12 +266,12 @@ declare class Artplayer extends Player {
|
|||||||
};
|
};
|
||||||
|
|
||||||
readonly hotkey: {
|
readonly hotkey: {
|
||||||
add(key: number, event: Function): Artplayer['hotkey'];
|
add(key: number, callback: EventCallback): Artplayer['hotkey'];
|
||||||
};
|
};
|
||||||
|
|
||||||
readonly plugins: {
|
readonly plugins: {
|
||||||
readonly id: number;
|
readonly id: number;
|
||||||
add(plugin: Function): Artplayer['plugins'];
|
add(plugin: Plugin): Artplayer['plugins'];
|
||||||
};
|
};
|
||||||
|
|
||||||
readonly i18n: {
|
readonly i18n: {
|
||||||
|
|||||||
Reference in new issue
Block a user