diff --git a/types/tus-js-client/index.d.ts b/types/tus-js-client/index.d.ts index 7904c61781..b071bdbbeb 100644 --- a/types/tus-js-client/index.d.ts +++ b/types/tus-js-client/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for tus-js-client 1.7 +// Type definitions for tus-js-client 1.8 // Project: https://github.com/tus/tus-js-client/ // Definitions by: Kevin Somers-Higgins // Marius Kleidl @@ -32,8 +32,9 @@ export class Upload { options: UploadOptions; url: string | null; + static terminate(url: string, options?: UploadOptions, callback?: (error?: Error) => void): void; start(): void; - abort(): void; + abort(shouldTerminate?: boolean, callback?: (error?: Error) => void): void; } export const isSupported: boolean; diff --git a/types/tus-js-client/tus-js-client-tests.ts b/types/tus-js-client/tus-js-client-tests.ts index e4701fdba0..cb18b6d478 100644 --- a/types/tus-js-client/tus-js-client-tests.ts +++ b/types/tus-js-client/tus-js-client-tests.ts @@ -39,6 +39,10 @@ const upload = new Tus.Upload(file, { upload.start(); upload.abort(); +upload.abort(true); +upload.abort(true, (err?: Error) => { + console.log("Failed because: " + err); +}); const upload2 = new Tus.Upload(file, { endpoint: "" @@ -51,3 +55,7 @@ const upload3 = new Tus.Upload(reader, { endpoint: '', uploadLengthDeferred: true, }); + +Tus.Upload.terminate('https://myurl.com', { + endpoint: "" +});