Skip to content

Commit

Permalink
docs(readme): update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuri committed Aug 6, 2017
1 parent 5628870 commit 694f2d6
Show file tree
Hide file tree
Showing 5 changed files with 932 additions and 24 deletions.
32 changes: 19 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ export class AppHomeComponent {
}

onUploadOutput(output: UploadOutput): void {
console.log(output); // lets output to see what's going on in the console

if (output.type === 'allAddedToQueue') { // when all files added in queue
// uncomment this if you want to auto upload files when added
// const event: UploadInput = {
Expand All @@ -121,39 +119,47 @@ export class AppHomeComponent {
// concurrency: 0
// };
// this.uploadInput.emit(event);
} else if (output.type === 'addedToQueue') {
this.files.push(output.file); // add file to array when added
} else if (output.type === 'uploading') {
} else if (output.type === 'addedToQueue' && typeof output.file !== 'undefined') { // add file to array when added
this.files.push(output.file);
} else if (output.type === 'uploading' && typeof output.file !== 'undefined') {
// update current data in files array for uploading file
const index = this.files.findIndex(file => file.id === output.file.id);
const index = this.files.findIndex(file => typeof output.file !== 'undefined' && file.id === output.file.id);
this.files[index] = output.file;
} else if (output.type === 'removed') {
// remove file from array when removed
this.files = this.files.filter((file: UploadFile) => file !== output.file);
} else if (output.type === 'dragOver') { // drag over event
} else if (output.type === 'dragOver') {
this.dragOver = true;
} else if (output.type === 'dragOut') { // drag out event
} else if (output.type === 'dragOut') {
this.dragOver = false;
} else if (output.type === 'drop') { // on drop event
} else if (output.type === 'drop') {
this.dragOver = false;
}
}

startUpload(): void { // manually start uploading
startUpload(): void {
const event: UploadInput = {
type: 'uploadAll',
url: '/upload',
url: 'http://ngx-uploader.com/upload',
method: 'POST',
data: { foo: 'bar' },
concurrency: 1 // set sequential uploading of files with concurrency 1
}
concurrency: this.formData.concurrency
};

this.uploadInput.emit(event);
}

cancelUpload(id: string): void {
this.uploadInput.emit({ type: 'cancel', id: id });
}

removeFile(id: string): void {
this.uploadInput.emit({ type: 'remove', id: id });
}

removeAllFiles(): void {
this.uploadInput.emit({ type: 'removeAll' });
}
}
```

Expand Down
Loading

0 comments on commit 694f2d6

Please sign in to comment.