Skip to content

Commit 3b99caf

Browse files
committed
Add notes re. dropzone behaviour
1 parent c45f51b commit 3b99caf

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,19 +175,23 @@ export class AppComponent {
175175
apiKey: 'free', // Get API keys from: www.bytescale.com
176176
multi: false
177177
};
178-
// 'onUpdate' vs 'onComplete' attrs on 'upload-dropzone':
179-
// - Dropzones are non-terminal by default (they don't have an end
180-
// state), so by default we use 'onUpdate' instead of 'onComplete'.
181-
// - To create a terminal dropzone, use the 'onComplete' attribute
182-
// instead and add the 'showFinishButton: true' option.
183-
onUpdate = (event: UploadWidgetOnUpdateEvent) => {
184-
alert(event.uploadedFiles.map(x => x.fileUrl).join("\n"));
178+
onUpdate = ({ uploadedFiles, pendingFiles }: UploadWidgetOnUpdateEvent) => {
179+
const uploadedFileUrls = uploadedFiles.map(x => x.fileUrl).join("\n");
180+
console.log(uploadedFileUrls);
185181
};
186182
width = "600px";
187183
height = "375px";
188184
}
189185
```
190186

187+
> **Special behaviour for dropzones:**
188+
>
189+
> `onComplete` only fires when `showFinishButton = true` (i.e. when the user clicks "Finish").
190+
>
191+
> `onUpdate` must be used when `showFinishButton = false`.
192+
>
193+
> Default value: `showFinishButton = false`
194+
191195
## Result
192196

193197
The callbacks receive a `Array<UploadWidgetResult>`:

0 commit comments

Comments
 (0)