From f92ea3a007b79b9ac2ec7eb08313a409cd19ba4b Mon Sep 17 00:00:00 2001 From: kanno <812137533@qq.com> Date: Thu, 28 Jul 2022 10:09:03 +0800 Subject: [PATCH] feat(declaration): update api & fix umd can't get type --- dist/index.d.ts | 12 ++++++++---- vite_vue_ts/global.d.ts | 12 ++++++++---- vite_vue_ts/tsconfig.json | 3 ++- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/dist/index.d.ts b/dist/index.d.ts index 1b73f169..5041db7a 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,4 +1,4 @@ -export interface ExtraConfig { +export interface Web265JsExtraConfig { moovStartFlag?: boolean rawFps?: number autoCrop?: boolean @@ -29,7 +29,7 @@ export interface Web265JsConfig { * player token value */ token: string - extInfo?: ExtraConfig + extInfo?: Web265JsExtraConfig } export interface Web265JsMediaInfo { @@ -76,6 +76,8 @@ interface New265WebJs { playNextFrame(): void snapshot(): void release(): void + setPlaybackRate(rate: number): void + getPlaybackRate(): number } declare type new265webJsFn = ( @@ -83,8 +85,10 @@ declare type new265webJsFn = ( config: Web265JsConfig ) => New265WebJs -interface Window { - new265webjs: new265webJsFn +declare global { + interface Window { + new265webjs: new265webJsFn + } } export default class H265webjsModule { diff --git a/vite_vue_ts/global.d.ts b/vite_vue_ts/global.d.ts index 3737761e..a43bd87c 100644 --- a/vite_vue_ts/global.d.ts +++ b/vite_vue_ts/global.d.ts @@ -1,4 +1,4 @@ -export interface ExtraConfig { +export interface Web265JsExtraConfig { moovStartFlag?: boolean rawFps?: number autoCrop?: boolean @@ -29,7 +29,7 @@ export interface Web265JsConfig { * player token value */ token: string - extInfo?: ExtraConfig + extInfo?: Web265JsExtraConfig } export interface Web265JsMediaInfo { @@ -76,6 +76,8 @@ interface New265WebJs { playNextFrame(): void snapshot(): void release(): void + setPlaybackRate(rate: number): void + getPlaybackRate(): number } declare type new265webJsFn = ( @@ -83,8 +85,10 @@ declare type new265webJsFn = ( config: Web265JsConfig ) => New265WebJs -interface Window { - new265webjs: new265webJsFn +declare global { + interface Window { + new265webjs: new265webJsFn + } } export default class H265webjsModule { diff --git a/vite_vue_ts/tsconfig.json b/vite_vue_ts/tsconfig.json index a9205d94..7b08d51e 100644 --- a/vite_vue_ts/tsconfig.json +++ b/vite_vue_ts/tsconfig.json @@ -14,5 +14,6 @@ "lib": ["esnext", "dom", "dom.iterable"], }, - "include": ["global.d.ts","shim.vue.d.ts","src/**/*.vue", "src/**/*.ts",] + "files": ["global.d.ts"], + "include": ["shim.vue.d.ts","src"] } \ No newline at end of file