Skip to content

Commit

Permalink
Expose addFiles method (23#412)
Browse files Browse the repository at this point in the history
- Expose `addFiles` method that takes an array of File objects.
  • Loading branch information
zzarcon authored and Christian Palmhøj Nielsen committed Oct 26, 2017
1 parent b6e7786 commit 6743322
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ adding the file. (Default: `null`)
* `.progress()` Returns a float between 0 and 1 indicating the current upload progress of all files.
* `.isUploading()` Returns a boolean indicating whether or not the instance is currently uploading anything.
* `.addFile(file)` Add a HTML5 File object to the list of files.
* `.addFiles(files)` Add an Array of HTML5 File objects to the list of files.
* `.removeFile(file)` Cancel upload of a specific `ResumableFile` object on the list from the list.
* `.getFromUniqueIdentifier(uniqueIdentifier)` Look up a `ResumableFile` object by its unique identifier.
* `.getSize()` Returns the total size of the upload in bytes.
Expand Down
1 change: 1 addition & 0 deletions resumable-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ let resumable: Resumable = new Resumable({chunkSize: 123});
let resumableNoOpts: Resumable = new Resumable();

resumable.addFile(new File([], 'test.tmp'), {});
resumable.addFiles([new File([], 'test.tmp')], {});
resumable.assignBrowse(document, true);
resumable.assignBrowse([document], true);
resumable.assignDrop(document);
Expand Down
4 changes: 4 additions & 0 deletions resumable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ declare module Resumable {
* Add a HTML5 File object to the list of files.
**/
addFile(file: File): void;
/**
* Add an Array of HTML5 File objects to the list of files.
**/
addFiles(files: Array<File>): void;
/**
* Cancel upload of a specific ResumableFile object on the list from the list.
**/
Expand Down
3 changes: 3 additions & 0 deletions resumable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,9 @@
$.addFile = function(file, event){
appendFilesFromFileList([file], event);
};
$.addFiles = function(files, event){
appendFilesFromFileList(files, event);
};
$.removeFile = function(file){
for(var i = $.files.length - 1; i >= 0; i--) {
if($.files[i] === file) {
Expand Down

0 comments on commit 6743322

Please sign in to comment.