From 4caef8b7190d5019a9e143c46da03b80f79b1fef Mon Sep 17 00:00:00 2001 From: "Ifedapo .A. Olarewaju" Date: Mon, 25 Nov 2019 20:04:29 +0100 Subject: [PATCH] [tus-js-client] Align definitions with v1.8 (#40629) * update tus-js-client definition to match 1.8 * Update tus-js-client test * [tus-js-client]: remove trailing whitespace * [tus-js-client]: fix test on upload.abort method --- types/tus-js-client/index.d.ts | 5 +++-- types/tus-js-client/tus-js-client-tests.ts | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) 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: "" +});