Skip to content

Commit

Permalink
Typescript side fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
HyopeR committed May 5, 2024
1 parent df70680 commit a7e0a5a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ export interface DownloadHeaders {
[key: string]: string | null;
}

type SetConfig = (
export interface Config {
headers: DownloadHeaders,
progressInterval: number,
isLogsEnabled: boolean
) => void;
}

type SetConfig = (config: Partial<Config>) => void;

export interface BeginHandlerObject {
expectedBytes: number;
Expand Down Expand Up @@ -78,6 +80,7 @@ export interface DownloadTask {

id: string;
state: DownloadTaskState;
metadata: Record<string, any>;
bytesDownloaded: number;
bytesTotal: number;

Expand Down
5 changes: 5 additions & 0 deletions lib/DownloadTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export default class DownloadTask {
bytesDownloaded = 0
bytesTotal = 0

beginHandler
progressHandler
doneHandler
errorHandler

constructor (taskInfo: TaskInfo, originalTask?: TaskInfo) {
this.id = taskInfo.id
this.bytesDownloaded = taskInfo.bytesDownloaded ?? 0
Expand Down

0 comments on commit a7e0a5a

Please sign in to comment.