Skip to content

Commit

Permalink
@uppy/core: type more events (#4719)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 authored Oct 3, 2023
1 parent c0f7d76 commit 9353c4c
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions packages/@uppy/core/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ export type ProgressCallback = (progress: number) => void
export type PreProcessCompleteCallback<TMeta extends IndexedObject<any>> = (
file: UppyFile<TMeta> | undefined,
) => void
export type UploadPauseCallback = (
fileID: UppyFile['id'] | undefined,
isPaused: boolean,
) => void
export type UploadProgressCallback<TMeta extends IndexedObject<any>> = (
file: UppyFile<TMeta> | undefined,
progress: FileProgress,
Expand All @@ -253,6 +257,8 @@ export type UploadErrorCallback<TMeta extends IndexedObject<any>> = (
response?: ErrorResponse,
) => void
export type UploadRetryCallback = (fileID: string) => void
export type PauseAllCallback = (fileIDs: string[]) => void
export type ResumeAllCallback = (fileIDs: string[]) => void
export type RetryAllCallback = (fileIDs: string[]) => void
export type RestrictionFailedCallback<TMeta extends IndexedObject<any>> = (
file: UppyFile<TMeta> | undefined,
Expand All @@ -262,24 +268,27 @@ export type RestrictionFailedCallback<TMeta extends IndexedObject<any>> = (
export interface UppyEventMap<
TMeta extends IndexedObject<any> = Record<string, unknown>,
> {
'cancel-all': GenericEventCallback
complete: UploadCompleteCallback<TMeta>
error: ErrorCallback
'file-added': FileAddedCallback<TMeta>
'files-added': FilesAddedCallback<TMeta>
'file-removed': FileRemovedCallback<TMeta>
upload: UploadCallback
progress: ProgressCallback
'files-added': FilesAddedCallback<TMeta>
'info-hidden': GenericEventCallback
'info-visible': GenericEventCallback
'pause-all': PauseAllCallback
'preprocess-complete': PreProcessCompleteCallback<TMeta>
'upload-progress': UploadProgressCallback<TMeta>
'upload-success': UploadSuccessCallback<TMeta>
complete: UploadCompleteCallback<TMeta>
error: ErrorCallback
progress: ProgressCallback
'reset-progress': GenericEventCallback
'resume-all': ResumeAllCallback
'restriction-failed': RestrictionFailedCallback<TMeta>
'retry-all': RetryAllCallback
'upload-error': UploadErrorCallback<TMeta>
'upload-pause': UploadPauseCallback
'upload-progress': UploadProgressCallback<TMeta>
'upload-retry': UploadRetryCallback
'retry-all': RetryAllCallback
'info-visible': GenericEventCallback
'info-hidden': GenericEventCallback
'cancel-all': GenericEventCallback
'restriction-failed': RestrictionFailedCallback<TMeta>
'reset-progress': GenericEventCallback
'upload-success': UploadSuccessCallback<TMeta>
upload: UploadCallback
}

export class Uppy {
Expand Down

0 comments on commit 9353c4c

Please sign in to comment.