Skip to content

Commit

Permalink
Add notes re. dropzone behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
ljwagerfield committed Sep 23, 2023
1 parent c45f51b commit 3b99caf
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,19 +175,23 @@ export class AppComponent {
apiKey: 'free', // Get API keys from: www.bytescale.com
multi: false
};
// 'onUpdate' vs 'onComplete' attrs on 'upload-dropzone':
// - Dropzones are non-terminal by default (they don't have an end
// state), so by default we use 'onUpdate' instead of 'onComplete'.
// - To create a terminal dropzone, use the 'onComplete' attribute
// instead and add the 'showFinishButton: true' option.
onUpdate = (event: UploadWidgetOnUpdateEvent) => {
alert(event.uploadedFiles.map(x => x.fileUrl).join("\n"));
onUpdate = ({ uploadedFiles, pendingFiles }: UploadWidgetOnUpdateEvent) => {
const uploadedFileUrls = uploadedFiles.map(x => x.fileUrl).join("\n");
console.log(uploadedFileUrls);
};
width = "600px";
height = "375px";
}
```

> **Special behaviour for dropzones:**
>
> `onComplete` only fires when `showFinishButton = true` (i.e. when the user clicks "Finish").
>
> `onUpdate` must be used when `showFinishButton = false`.
>
> Default value: `showFinishButton = false`
## Result

The callbacks receive a `Array<UploadWidgetResult>`:
Expand Down

0 comments on commit 3b99caf

Please sign in to comment.