Skip to content

Commit

Permalink
meta: Comment on what we want to do about close, resetProgress, clear…
Browse files Browse the repository at this point in the history
…UploadedFiles, etc in the next major (#4865)

Comment on what we want to do about close, resetProgress, clearUploadedFiles, etc in the next major
  • Loading branch information
arturi committed Jan 16, 2024
1 parent 06371a9 commit 4753a05
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/@uppy/core/src/Uppy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ export class Uppy<M extends Meta, B extends Body> {
this.setState(undefined) // so that UI re-renders with new options
}

// todo next major: rename to something better? (it doesn't just reset progress)
// todo next major: remove
resetProgress(): void {
const defaultProgress: Omit<FileProgressNotStarted, 'bytesTotal'> = {
percentage: 0,
Expand All @@ -580,6 +580,8 @@ export class Uppy<M extends Meta, B extends Body> {
this.emit('reset-progress')
}

// @todo next major: rename to `clear()`, make it also cancel ongoing uploads
// or throw and say you need to cancel manually
protected clearUploadedFiles(): void {
this.setState({ ...defaultUploadState, files: {} })
}
Expand Down Expand Up @@ -1773,6 +1775,10 @@ export class Uppy<M extends Meta, B extends Body> {
/**
* Uninstall all plugins and close down this Uppy instance.
*/
// @todo next major: rename to `destroy`.
// Cancel local uploads, cancel remote uploads, DON'T cancel assemblies
// document that if you do want to cancel assemblies, you need to call smth manually.
// Potentially remove reason, as it’s confusing, just come up with a default behaviour.
close({ reason }: { reason?: FileRemoveReason } | undefined = {}): void {
this.log(
`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`,
Expand Down

0 comments on commit 4753a05

Please sign in to comment.