diff --git a/index.d.ts b/index.d.ts index 8fc9984..67871bc 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,115 +1,114 @@ interface ASS_Event { - Start: number; - Duration: number; - Style: string; - Name: string; - MarginL: number; - MarginR: number; - MarginV: number; - Effect: string; - Text: string; - ReadOrder: number; - Layer: number; - _index: number; + Start: number; + Duration: number; + Style: string; + Name: string; + MarginL: number; + MarginR: number; + MarginV: number; + Effect: string; + Text: string; + ReadOrder: number; + Layer: number; + _index: number; } interface ASS_Style { - Name: string; - FontName: string; - FontSize: number; - PrimaryColour: number; - SecondaryColour: number; - OutlineColour: number; - BackColour: number; - Bold: number; - Italic: number; - Underline: number; - StrikeOut: number; - ScaleX: number; - ScaleY: number; - Spacing: number; - Angle: number; - BorderStyle: number; - Outline: number; - Shadow: number; - Alignment: number; - MarginL: number; - MarginR: number; - MarginV: number; - Encoding: number; - treat_fontname_as_pattern: number; - Blur: number; - Justify: number; + Name: string; + FontName: string; + FontSize: number; + PrimaryColour: number; + SecondaryColour: number; + OutlineColour: number; + BackColour: number; + Bold: number; + Italic: number; + Underline: number; + StrikeOut: number; + ScaleX: number; + ScaleY: number; + Spacing: number; + Angle: number; + BorderStyle: number; + Outline: number; + Shadow: number; + Alignment: number; + MarginL: number; + MarginR: number; + MarginV: number; + Encoding: number; + treat_fontname_as_pattern: number; + Blur: number; + Justify: number; } interface JassubOptions { - video: HTMLVideoElement; - canvas?: HTMLCanvasElement; + video?: HTMLVideoElement; + canvas?: HTMLCanvasElement; - blendMode?: "js" | "wasm"; + blendMode?: 'js' | 'wasm'; - asyncRender?: boolean; - offscreenRender?: boolean; - onDemandRender?: boolean; - targetFps?: number; - timeOffset?: number; + asyncRender?: boolean; + offscreenRender?: boolean; + onDemandRender?: boolean; + targetFps?: number; + timeOffset?: number; - debug?: boolean; - prescaleFactor?: number; - prescaleHeightLimit?: number; - maxRenderHeight?: number; - dropAllAnimations?: boolean; - dropAllBlur?: boolean + debug?: boolean; + prescaleFactor?: number; + prescaleHeightLimit?: number; + maxRenderHeight?: number; + dropAllAnimations?: boolean; + dropAllBlur?: boolean - workerUrl?: string; - wasmUrl?: string; - legacyWasmUrl?: string; - modernWasmUrl?: string; + workerUrl?: string; + wasmUrl?: string; + legacyWasmUrl?: string; + modernWasmUrl?: string; - subUrl?: string; - subContent?: string; + subUrl?: string; + subContent?: string; - fonts?: string[] | Uint8Array[]; - availableFonts?: Record; - fallbackFont?: string; - useLocalFonts?: boolean; + fonts?: string[] | Uint8Array[]; + availableFonts?: Record; + fallbackFont?: string; + useLocalFonts?: boolean; - libassMemoryLimit?: number; - libassGlyphLimit?: number; + libassMemoryLimit?: number; + libassGlyphLimit?: number; } type ASS_EventCallback = (error: Error | null, event: ASS_Event) => void; type ASS_StyleCallback = (error: Error | null, event: ASS_Style) => void; export default class JASSUB { + constructor (options: JassubOptions); - constructor (options: JassubOptions); + resize (width?: number, height?: number, top?: number, left?: number): void; + setVideo (video: HTMLVideoElement): void; + runBenchmark (): void; - resize (width?: number, height?: number, top?: number, left?: number): void; - setVideo (video: HTMLVideoElement): void; - runBenchmark (): void; + setTrackByUrl (url: string): void; + setTrack (content: string): void; + freeTrack (): void; - setTrackByUrl (url: string): void; - setTrack (content: string): void; - freeTrack (): void; + setIsPaused (isPaused: boolean): void; + setRate (rate: number): void; + setCurrentTime (isPaused?: boolean, currentTime?: number, rate?: number): void; - setIsPaused (isPaused: boolean): void; - setRate (rate: number): void; - setCurrentTime (isPaused?: boolean, currentTime?: number, rate?: number): void; + createEvent (event: ASS_Event): void; + setEvent (event: ASS_Event, index: number): void; + removeEvent (index: number): void; + getEvents (callback: ASS_EventCallback): void; - createEvent (event: ASS_Event): void; - setEvent (event: ASS_Event, index: number): void; - removeEvent (index: number): void; - getEvents (callback: ASS_EventCallback): void; + createStyle (style: ASS_Style): void; + setStyle (style: ASS_Style, index: number): void; + removeStyle (index: number): void; + getStyles (callback: ASS_StyleCallback): void; - createStyle (style: ASS_Style): void; - setStyle (style: ASS_Style, index: number): void; - removeStyle (index: number): void; - getStyles (callback: ASS_StyleCallback): void; + addFont (font: string | Uint8Array): void; - addFont (font: string | Uint8Array): void; - - sendMessage (target: string, data?: Record, transferable?: Transferable[]): void; - destroy (err?: string): void; + sendMessage (target: string, data?: Record, transferable?: Transferable[]): void; + destroy (err?: string): void; } diff --git a/package.json b/package.json index a5f06bf..6cbd03a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jassub", - "version": "1.7.15", + "version": "1.7.16", "description": "libass Subtitle Renderer and Parser library for browsers", "main": "src/jassub.js", "type": "module",