diff --git a/jquery.fileupload/jquery.fileupload-tests.ts b/jquery.fileupload/jquery.fileupload-tests.ts index 87149e0151..f07c60b87d 100644 --- a/jquery.fileupload/jquery.fileupload-tests.ts +++ b/jquery.fileupload/jquery.fileupload-tests.ts @@ -13,6 +13,18 @@ var __handleAddingFile = function (event:any, data:any) data.submit(); }; +var options: JQueryFileInputOptions = { + dataType: 'json', + singleFileUploads: true, + limitMultiFileUploads: 1, + add: __handleAddingFile, + done: (e, data) => { + data.result; + data.jqXHR; + data.textStatus; + } +} + class TestFileInput { // The whole body will be the container for this test @@ -24,20 +36,6 @@ class TestFileInput { constructor() { // The file upload object receives a fileInputOptions configuration object - this.fileInput = this.$el.fileupload({ - - dataType: 'json', - - // By default, each file of a selection is uploaded using an individual - // request for XHR type uploads. Set to false to upload file - // selections in one request each: - singleFileUploads: true, - // To limit the number of files uploaded with one XHR request, - // set the following option to an integer greater than 0: - limitMultiFileUploads: 1, - - add: __handleAddingFile - - }); + this.fileInput = this.$el.fileupload(options); } } diff --git a/jquery.fileupload/jquery.fileupload.d.ts b/jquery.fileupload/jquery.fileupload.d.ts index eb47f6e172..3cf92af62c 100644 --- a/jquery.fileupload/jquery.fileupload.d.ts +++ b/jquery.fileupload/jquery.fileupload.d.ts @@ -212,7 +212,7 @@ interface JQueryFileInputOptions { // Other callbacks: submit?: Function; - done?: Function; + done?: (e: JQueryEventObject, data: JQueryFileUploadDone) => void; fail?: Function; always?: Function; progressall?: (e: JQueryEventObject, data: JQueryFileUploadProgressAllObject) => void; @@ -265,19 +265,25 @@ interface JQueryFileUploadProgressAllObject { bitrate?: number; } -interface JQueryFileUploadProgressObject extends JQueryFileInputOptions, JQueryFileUploadProgressAllObject { +interface JQueryFileUploadWithXhr { + jqXHR: JQueryXHR; + result: any; + textStatus: string; } interface JQueryFileUploadFilesObject { files: File[]; } -interface JQueryFileUploadChunkObject extends JQueryFileInputOptions { +interface JQueryFileUploadChunkObject extends JQueryFileInputOptions, JQueryFileUploadWithXhr { blob: any; chunkSize: number; contentRange: string; errorThrown: any; - jqXHR: JQueryXHR; - result: any; - textStatus: string; +} + +interface JQueryFileUploadProgressObject extends JQueryFileInputOptions, JQueryFileUploadProgressAllObject { +} + +interface JQueryFileUploadDone extends JQueryFileInputOptions, JQueryFileUploadWithXhr { } \ No newline at end of file