Skip to content

Commit

Permalink
feat(declaration): update api & fix umd can't get type
Browse files Browse the repository at this point in the history
  • Loading branch information
nonzzz committed Jul 28, 2022
1 parent 8f34a0a commit f92ea3a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
12 changes: 8 additions & 4 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export interface ExtraConfig {
export interface Web265JsExtraConfig {
moovStartFlag?: boolean
rawFps?: number
autoCrop?: boolean
Expand Down Expand Up @@ -29,7 +29,7 @@ export interface Web265JsConfig {
* player token value
*/
token: string
extInfo?: ExtraConfig
extInfo?: Web265JsExtraConfig
}

export interface Web265JsMediaInfo {
Expand Down Expand Up @@ -76,15 +76,19 @@ interface New265WebJs {
playNextFrame(): void
snapshot(): void
release(): void
setPlaybackRate(rate: number): void
getPlaybackRate(): number
}

declare type new265webJsFn = (
url: string,
config: Web265JsConfig
) => New265WebJs

interface Window {
new265webjs: new265webJsFn
declare global {
interface Window {
new265webjs: new265webJsFn
}
}

export default class H265webjsModule {
Expand Down
12 changes: 8 additions & 4 deletions vite_vue_ts/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export interface ExtraConfig {
export interface Web265JsExtraConfig {
moovStartFlag?: boolean
rawFps?: number
autoCrop?: boolean
Expand Down Expand Up @@ -29,7 +29,7 @@ export interface Web265JsConfig {
* player token value
*/
token: string
extInfo?: ExtraConfig
extInfo?: Web265JsExtraConfig
}

export interface Web265JsMediaInfo {
Expand Down Expand Up @@ -76,15 +76,19 @@ interface New265WebJs {
playNextFrame(): void
snapshot(): void
release(): void
setPlaybackRate(rate: number): void
getPlaybackRate(): number
}

declare type new265webJsFn = (
url: string,
config: Web265JsConfig
) => New265WebJs

interface Window {
new265webjs: new265webJsFn
declare global {
interface Window {
new265webjs: new265webJsFn
}
}

export default class H265webjsModule {
Expand Down
3 changes: 2 additions & 1 deletion vite_vue_ts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}

0 comments on commit f92ea3a

Please sign in to comment.